Package io.quarkus.qute
Class UserTagSectionHelper.Factory
- java.lang.Object
-
- io.quarkus.qute.UserTagSectionHelper.Factory
-
- All Implemented Interfaces:
SectionHelperFactory<UserTagSectionHelper>
- Enclosing class:
- UserTagSectionHelper
public static class UserTagSectionHelper.Factory extends Object
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.quarkus.qute.SectionHelperFactory
SectionHelperFactory.BlockInfo, SectionHelperFactory.ParametersInfo, SectionHelperFactory.ParserDelegate, SectionHelperFactory.SectionInitContext
-
-
Field Summary
-
Fields inherited from interface io.quarkus.qute.SectionHelperFactory
MAIN_BLOCK_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getDefaultAliases()protected StringgetFragmentId(String templateId, SectionHelperFactory.SectionInitContext context)SectionHelperFactory.ParametersInfogetParameters()A factory may definefactory parametersfor the start tag of any section block.protected StringgetTemplateId(SectionHelperFactory.SectionInitContext context)protected voidhandleParamInit(String key, String value, SectionHelperFactory.SectionInitContext context, Map<String,Expression> params)protected booleanignoreParameterInit(String key, String value)Tinitialize(SectionHelperFactory.SectionInitContext context)Initialize a new helper instance for a specific section node in a template.ScopeinitializeBlock(Scope outerScope, SectionHelperFactory.BlockInfo block)Initialize a section block.protected booleanisSinglePart(String value)protected UserTagSectionHelpernewHelper(Supplier<Template> template, Map<String,Expression> params, Map<String,SectionBlock> extendingBlocks, boolean isolated, SectionHelperFactory.SectionInitContext context)booleantreatUnknownSectionsAsBlocks()By default, all unknown nested sections are ignored, ie.protected booleanuseDefaultedKey(String key, String value)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.quarkus.qute.SectionHelperFactory
cacheFactoryConfig, getBlockLabels
-
-
-
-
Method Detail
-
getDefaultAliases
public List<String> getDefaultAliases()
- Returns:
- the list of default aliases used to match the helper
- See Also:
SectionHelperFactory.cacheFactoryConfig()
-
getParameters
public SectionHelperFactory.ParametersInfo getParameters()
Description copied from interface:SectionHelperFactoryA factory may definefactory parametersfor the start tag of any section block. A factoryParameterhas a name and optional default value. The default value is automatically assigned if no other value is set by a parser. A parameter may be optional. A non-optional parameter that has no value assigned results in a parser error.A section block in a template defines the
actual parameters:{! The value is "item.isActive". The name is not defined. !} {#if item.isActive}{/} {! The name is "age" and the value is "10". !} {#let age=10}{/}The actual parameters are parsed taking the factory parameters into account:- Named actual params are processed first and the relevant values are assigned, e.g. the param with name
agehas the value10, - Then, if the number of actual params is greater or equals to the number of factory params the values are set according to position of factory params,
- Otherwise, the values are set according to position but params with no default value take precedence.
- Finally, all unset parameters that define a default value are initialized with the default value.
- Returns:
- the factory parameters
- See Also:
SectionHelperFactory.cacheFactoryConfig(),SectionHelperFactory.BlockInfo.getParameters()
- Named actual params are processed first and the relevant values are assigned, e.g. the param with name
-
getTemplateId
protected String getTemplateId(SectionHelperFactory.SectionInitContext context)
-
newHelper
protected UserTagSectionHelper newHelper(Supplier<Template> template, Map<String,Expression> params, Map<String,SectionBlock> extendingBlocks, boolean isolated, SectionHelperFactory.SectionInitContext context)
-
handleParamInit
protected void handleParamInit(String key, String value, SectionHelperFactory.SectionInitContext context, Map<String,Expression> params)
-
treatUnknownSectionsAsBlocks
public boolean treatUnknownSectionsAsBlocks()
Description copied from interface:SectionHelperFactoryBy default, all unknown nested sections are ignored, ie. sections with labels not present in theSectionHelperFactory.getBlockLabels(). However, sometimes it might be useful to treat such sections as blocks. SeeIncludeSectionHelperfor an example.- Specified by:
treatUnknownSectionsAsBlocksin interfaceSectionHelperFactory<T extends SectionHelper>- Returns:
- true if unknown sections should not be ignored
-
initializeBlock
public Scope initializeBlock(Scope outerScope, SectionHelperFactory.BlockInfo block)
Description copied from interface:SectionHelperFactoryInitialize a section block.All section blocks are initialized before
SectionHelperFactory.initialize(SectionInitContext)is called.The factory is responsible to register all expression via
SectionHelperFactory.BlockInfo.addExpression(String, String). The expression can be then used duringSectionHelperFactory.initialize(SectionInitContext)viaSectionHelperFactory.SectionInitContext.getExpression(String)andSectionBlock.expressions.- Specified by:
initializeBlockin interfaceSectionHelperFactory<T extends SectionHelper>- Returns:
- a new scope if this section introduces a new scope, or the outer scope
- See Also:
SectionHelperFactory.BlockInfo.addExpression(String, String)
-
initialize
public T initialize(SectionHelperFactory.SectionInitContext context)
Description copied from interface:SectionHelperFactoryInitialize a new helper instance for a specific section node in a template.- Specified by:
initializein interfaceSectionHelperFactory<T extends SectionHelper>- Returns:
- a new helper instance
-
getFragmentId
protected String getFragmentId(String templateId, SectionHelperFactory.SectionInitContext context)
-
isSinglePart
protected boolean isSinglePart(String value)
-
-