Class GlobalContext
java.lang.Object
dev.jcputney.mjml.context.GlobalContext
Document-wide context gathered during head processing. Facade that delegates to three focused
sub-contexts:
MetadataContext— title, previewText, breakpoint, containerWidth, bodyBackgroundColor, headComments, fileStartContentStyleContext— fonts, fontUrlOverrides, styles, componentStyles, inlineStyles, mediaQueries, fluidOnMobileUsed, registeredStyleKeysAttributeContext— defaultAttributes, classAttributes, htmlAttributes
Access sub-contexts directly via metadata(), styles(), and attributes().
Thread safety: This class is not thread-safe. Each RenderPipeline creates its own instance, so concurrent renders do not
share a GlobalContext.
-
Constructor Summary
ConstructorsConstructorDescriptionGlobalContext(MjmlConfiguration configuration) Creates a new global context with the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionReturns the attribute cascade sub-context (defaults, classes, HTML attributes).Returns the MJML configuration for this render.metadata()Returns the document metadata sub-context (title, preview, breakpoint, etc.).styles()Returns the style sub-context (fonts, CSS, media queries, etc.).
-
Constructor Details
-
GlobalContext
Creates a new global context with the given configuration.- Parameters:
configuration- the MJML configuration for this render
-
-
Method Details
-
metadata
Returns the document metadata sub-context (title, preview, breakpoint, etc.).- Returns:
- the metadata sub-context
-
styles
Returns the style sub-context (fonts, CSS, media queries, etc.).- Returns:
- the style sub-context
-
attributes
Returns the attribute cascade sub-context (defaults, classes, HTML attributes).- Returns:
- the attribute cascade sub-context
-
getConfiguration
Returns the MJML configuration for this render.- Returns:
- the MJML configuration
-