Class FreemarkerResolverStrategy
java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.defaultvalue.FreemarkerResolverStrategy
- All Implemented Interfaces:
DefaultValueResolverStrategy
- Direct Known Subclasses:
FreemarkerQueryResolverStrategy
@Component
public class FreemarkerResolverStrategy
extends Object
implements DefaultValueResolverStrategy
Resolver strategy for default values. The default value tag can contain a freemarker template that is run through
the template engine at the time of execution.
-
Field Summary
Fields inherited from interface ch.tocco.nice2.model.base.spi.defaultvalue.spi.DefaultValueResolverStrategy
CURRENT_PRINCIPAL_VAL, CURRENT_USER_VAL, PRINCIPAL_ENTITY, USER_ENTITY
-
Constructor Summary
ConstructorDescriptionFreemarkerResolverStrategy
(TemplateEngineFactory templateEngineFactory, PrincipalService principalService, TypeManager typeManager) -
Method Summary
Modifier and TypeMethodDescriptiongetResolvedValue
(DefaultValueDescriptor defaultValue) Return the display value that is presented to end users.protected String
getTemplateValue
(DefaultValueDescriptor defaultValue) Process the provided default value with theTemplateEngine
and return the result.getType()
boolean
isResolvable
(DefaultValueDescriptor descriptor) Checks whether this strategy is capable of resolving the given descriptor.
-
Constructor Details
-
FreemarkerResolverStrategy
public FreemarkerResolverStrategy(TemplateEngineFactory templateEngineFactory, @Lazy PrincipalService principalService, TypeManager typeManager)
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceDefaultValueResolverStrategy
-
getResolvedValue
public ResolvedValue getResolvedValue(DefaultValueDescriptor defaultValue) throws ResolvingException Description copied from interface:DefaultValueResolverStrategy
Return the display value that is presented to end users.- Specified by:
getResolvedValue
in interfaceDefaultValueResolverStrategy
- Throws:
ResolvingException
-
isResolvable
Description copied from interface:DefaultValueResolverStrategy
Checks whether this strategy is capable of resolving the given descriptor.- Specified by:
isResolvable
in interfaceDefaultValueResolverStrategy
-
getTemplateValue
Process the provided default value with theTemplateEngine
and return the result.- Parameters:
defaultValue
- theDefaultValueDescriptor
holding the definition of the default value.- Returns:
- The default value as processed by the
TemplateEngine
.
-