public class FirstMatchTemplateConfigurationFactory extends TemplateConfigurationFactory
null
result of the child factories, ignoring all further child factories. The child
factories are called in the order as they were added.Constructor and Description |
---|
FirstMatchTemplateConfigurationFactory(TemplateConfigurationFactory... templateConfigurationFactories) |
Modifier and Type | Method and Description |
---|---|
FirstMatchTemplateConfigurationFactory |
allowNoMatch(boolean allow)
Same as
setAllowNoMatch(boolean) , but return this object to support "fluent API" style. |
TemplateConfiguration |
get(java.lang.String sourceName,
java.lang.Object templateSource)
Returns (maybe creates) the
TemplateConfiguration for the given template source. |
boolean |
getAllowNoMatch()
Getter pair of
setAllowNoMatch(boolean) . |
java.lang.String |
getNoMatchErrorDetails()
Use this to specify the text added to the exception error message when there was no matching choice.
|
FirstMatchTemplateConfigurationFactory |
noMatchErrorDetails(java.lang.String message)
Same as
setNoMatchErrorDetails(String) , but return this object to support "fluent API" style. |
void |
setAllowNoMatch(boolean allowNoMatch)
Use this to specify if having no matching choice is an error.
|
protected void |
setConfigurationOfChildren(Configuration cfg)
Calls
TemplateConfiguration.setParentConfiguration(Configuration) on each enclosed
TemplateConfiguration and TemplateConfigurationFactory.setConfiguration(Configuration)
on each enclosed TemplateConfigurationFactory objects. |
void |
setNoMatchErrorDetails(java.lang.String noMatchErrorDetails) |
getConfiguration, setConfiguration
public FirstMatchTemplateConfigurationFactory(TemplateConfigurationFactory... templateConfigurationFactories)
public TemplateConfiguration get(java.lang.String sourceName, java.lang.Object templateSource) throws java.io.IOException, TemplateConfigurationFactoryException
TemplateConfigurationFactory
TemplateConfiguration
for the given template source.get
in class TemplateConfigurationFactory
sourceName
- The name (path) that was used for TemplateLoader.findTemplateSource(String)
. See
Template.getSourceName()
for details.templateSource
- The object returned by TemplateLoader.findTemplateSource(String)
.TemplateConfiguration
to apply, or null
if the there's no TemplateConfiguration
for
this template source.java.io.IOException
- Typically, if there factory needs further I/O to find out more about the template source, but that
fails.TemplateConfigurationFactoryException
- If there's a problem that's specific to the factory logic.public boolean getAllowNoMatch()
setAllowNoMatch(boolean)
.public void setAllowNoMatch(boolean allowNoMatch)
false
, that is, it's an
error if there was no matching choice.setNoMatchErrorDetails(String)
public java.lang.String getNoMatchErrorDetails()
null
(no error details).setAllowNoMatch(boolean)
public void setNoMatchErrorDetails(java.lang.String noMatchErrorDetails)
public FirstMatchTemplateConfigurationFactory allowNoMatch(boolean allow)
setAllowNoMatch(boolean)
, but return this object to support "fluent API" style.public FirstMatchTemplateConfigurationFactory noMatchErrorDetails(java.lang.String message)
setNoMatchErrorDetails(String)
, but return this object to support "fluent API" style.protected void setConfigurationOfChildren(Configuration cfg)
TemplateConfigurationFactory
TemplateConfiguration.setParentConfiguration(Configuration)
on each enclosed
TemplateConfiguration
and TemplateConfigurationFactory.setConfiguration(Configuration)
on each enclosed TemplateConfigurationFactory
objects. It only supposed to call these on the direct
"children" of this object, not on the children of the children.setConfigurationOfChildren
in class TemplateConfigurationFactory