Class AttributeResolver

java.lang.Object
dev.jcputney.mjml.context.AttributeResolver

public final class AttributeResolver extends Object
Resolves attributes for a component using the 5-level cascade:
  1. Inline attributes (on the element itself)
  2. mj-class attributes
  3. Tag-specific default attributes (mj-attributes > mj-section, etc.)
  4. mj-all default attributes
  5. Component hardcoded defaults
  • Method Details

    • resolve

      public static String resolve(MjmlNode node, String attributeName, GlobalContext globalContext, Map<String,String> componentDefaults)
      Resolves an attribute value using the 5-level cascade.
      Parameters:
      node - the element node
      attributeName - the attribute to resolve
      globalContext - the document-wide context
      componentDefaults - the component's hardcoded default values
      Returns:
      the resolved attribute value, or null if not found at any level