Class AbstractTemplate
-
Field Summary
Modifier and TypeFieldDescriptionprotected BeanHandler
protected Map<String,
InternalValue> protected String
protected List<ResourceBundle>
protected TemplateEncoder
protected String
protected String
protected Map<String,
InternalString> protected TemplateInitializer
protected String
protected List<ResourceBundle>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addGeneratedValue
(String valueId) Registers a value IDs as being generated by RIFE2.final void
addGeneratedValues
(Collection<String> valueIds) Registers a collection of value IDs as being generated by RIFE2.final void
addResourceBundle
(ResourceBundle resourceBundle) Adds a resource bundle to this template.final void
addResourceBundles
(Collection<ResourceBundle> resourceBundles) Adds a list of resource bundles to this template.final void
appendBlock
(String valueBlockId) Appends the content of a block to a value.final void
appendBlock
(String valueId, String blockId) Appends the content of a block to a value.protected abstract boolean
appendBlockExternalForm
(String id, ExternalValue result) protected abstract boolean
appendBlockInternalForm
(String id, InternalValue result) protected abstract boolean
appendDefaultValueExternalForm
(String id, ExternalValue result) protected abstract boolean
appendDefaultValueInternalForm
(String id, InternalValue result) protected void
appendTextInternal
(InternalValue value, CharSequence text) final void
appendValue
(String id, boolean value) Appends"true"
or"false"
to the specified value in this template, depending on the givenvalue
.final void
appendValue
(String id, char value) Appends the single specified character to the specified value in this template.final void
appendValue
(String id, char[] value) Appends the given characters to the specified value in this template.final void
appendValue
(String id, char[] value, int offset, int count) Appends the specified range of the given character string to the specified value in this template.final void
appendValue
(String id, double value) Appends the given double precision floating point value to the specified value in this template.final void
appendValue
(String id, float value) Appends the given floating point value to the specified value in this template.final void
appendValue
(String id, int value) Appends the given integer to the specified value in this template.final void
appendValue
(String id, long value) Appends the given long to the specified value in this template.final void
appendValue
(String id, Object value) Appends the result of callingString.valueOf
on the givenvalue
to the specified value in this template.final void
appendValue
(String id, String value) Appends the given string, or an empty string ifvalue
isnull
, to the specified value in this template.final void
appendValueEncoded
(String id, Object value) Appends the result of callingString.valueOf
on the givenvalue
to the specified value in this template and encodes it with theTemplateEncoder
that's registered for this templateprotected final void
appendValueExternalForm
(String id, String tag, ExternalValue result) protected final void
appendValueInternalForm
(String id, String tag, InternalValue result) final void
blankValue
(String id) Set the content of the specified value to an empty string.final void
clear()
Resets all values in this template and removes any resource bundles.clone()
Returns a shallow copy of this template, with the same values.final int
Returns the number of values in this template which have been set.final InternalValue
Returns an anonymous value that can be used to construct complex content for use within this template.Creates a new template, using the same factory, name and encoding as those that were used to create this template instance.Fills all values in this template which match "l10n:key
", where "key
" is a key in a resource bundle registered for this template.Fills the value "lang:id
" with the value of the block "lang:id:langid
", where "id
" is the given ID, and "langid
" is this template's current language ID.Evaluates all values in this template with ID's of the form "render:class
" or "render:class:differentiator
r", where "class
" is the fully-qualified name of a class which extendsValueRenderer
, the result of callingValueRenderer.render
on a new instance of the class.getAttribute
(String name) Returns the data of an attribute that was set in this template instance.Returns the name and data of all attributes that have been set in this template instance.abstract String[]
Returns a list of the ID's of all values present in this template, including set and unset values.final BeanHandler
Returns this template's bean handler.Returns the evaluated content of the specified block as a text.final String
Returns the entire content of the template and finalize all non evaluated values.Returns this template's default content type, for exampletext/html
.abstract String
Returns the original text of the specified value, before any modification that may have been made usingTemplate.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
or similar methods.final List<CharSequence>
Returns the content of the specified block as a list with all the individual parts.final List<CharSequence>
Returns the content of this template as a list with all the individual parts.final TemplateEncoder
Returns the encoder that this template uses to convert strings to values in the template's generated text output.final String
Returns the encoding of this the content of this template.final String
Returns the unique identifier of the factory that was used to instantiate this template.abstract String[]
getFilteredBlock
(String filter, String id) Returns the matched data of a block that matched a particular filter at template compilation.abstract Collection<String[]>
getFilteredBlocks
(String filter) Each template type supports a set of special block tags that are used for adding automated features like localization, config value setting, ...abstract String[]
getFilteredValue
(String filter, String id) Returns the matched data of a value that matched a particular filter at template compilation.abstract Collection<String[]>
getFilteredValues
(String filter) Each template type supports a set of special value tags that are used for adding automated features like authentication, localization, value rendering, config value setting, ...final FormBuilder
Returns this template's form builder.Returns this template's current 2-letter language code.abstract long
Returns when the file corresponding to this template was modified, in milliseconds since the Unix epoch.final List<ResourceBundle>
Returns a list of the resource bundles used by this template.abstract Collection<String>
Returns a collection of the ID's of all values in this template which have not been set.final String
Returns the current content of the specified value as a string.getValueOrAttribute
(String name) Returns the content of a value or the data of an attribute with a particular name.boolean
hasAttribute
(String name) Checks whether an attribute exists in this template instance.final boolean
Returns whether this template contains a block with the given ID.boolean
Returns whether a default value was specified in this template for the specified value.abstract boolean
hasFilteredBlocks
(String filter) Returns whether any block matched a particular filter at template compilation.abstract boolean
hasFilteredValues
(String filter) Returns whether any value matched a particular filter at template compilation.final boolean
Returns whether this template has any resource bundles registered.abstract boolean
hasValueId
(String id) Returns whether this template contains a value with the given ID.protected void
increasePartsCapacityInternal
(InternalValue value, int size) protected void
increaseValuesCapacityInternal
(InternalValue value, int size) protected static boolean
isTemplateClassModified
(URL templateResource, long templateModificationTime, Map<URL, Long> templateDependencies, String templateModificationState, ResourceFinder resourceFinder, String modificationState) final boolean
Returns whether the specified value has been generated by RIFE2.final boolean
isValueSet
(String id) Returns whether the specified value has been set.protected final String
void
removeAttribute
(String name) Removes an attribute from this template instance.void
removeBean
(Object bean) Reverts all values to their defaults when the identifiers match properties of the given bean, whether those values were set with a previous call tosetBean
.void
removeBean
(Object bean, String prefix) Reverts all values to their defaults when the identifiers match properties of the given bean preceded by the given prefix, whether or not those values were set with a previous call tosetBean
.final void
Reverts the generated values back to their default value.final void
removeValue
(String id) Reverts the specified value back to its default value.final void
removeValues
(Collection<String> ids) Reverts the specified values back to their default value.void
setAttribute
(String name, Object value) Sets an attribute that will be associated with this template instance.void
setAttributes
(Map<String, Object> map) Sets the given attributes to the corresponding data.void
Sets all values in this template whose identifiers match names of properties in the given bean.void
Sets all values in this template whose names match names of properties in the given bean, preceded by the given prefix.void
Sets all values in this template whose names match names of properties in the given bean, preceded by the given prefix, if present.final void
Replaces the specified value with the content of the specified block.final void
Replaces the specified value with the content of the specified block.void
setDefaultContentType
(String defaultContentType) void
setLanguage
(String lang) Sets this template's current language code, such as "en".final void
Sets the specified value in this template totrue
orfalse
depending on the givenvalue
.final void
Sets the specified value in this template to the single specified character.final void
Sets the specified value in this template to the given characters.final void
Sets the specified value in this template to the specified range of the given character string.final void
Sets the specified value in this template to the given double precision floating point value.final void
Sets the specified value in this template to the given floating point value.final void
Sets the specified value in this template to the given integer.final void
Sets the specified value in this template to the given long.final void
setValue
(String id, CharSequence value) Sets the specified value in this template to the given character sequence, or an empty character sequence ifvalue
isnull
.final void
Sets the specified value in this template to the result of callingString.valueOf
on the givenvalue
.final void
Sets the specified value in this template to the given string, or an empty string ifvalue
isnull
.final void
setValue
(String id, List<CharSequence> deferredContent) Sets the specified value in this template to content that's structured in the internal format.final void
setValue
(String id, InternalValue internalValue) Sets the specified value in this template to the value of the given internal value.final void
Sets the specified value in this template to the current content of the given template.final void
setValueEncoded
(String id, Object value) Sets the specified value in this template to the result of callingString.valueOf
on the givenvalue
and encodes it with theTemplateEncoder
that's registered for this templatefinal void
write
(OutputStream out) This method is a shorthand forTemplate.writeContent(OutputStream)
.void
writeBlock
(String id, OutputStream out) Writes the evaluated contents of the specified block to the given output stream, usingUTF-8
encoding.void
writeBlock
(String id, OutputStream out, String charsetName) final void
writeContent
(OutputStream out) Writes the complete evaluated template content to the given stream, using UTF-8 encoding.final void
writeContent
(OutputStream out, String charsetName) Writes the complete evaluated template content to the given stream, using the specified charset for encoding.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface rife.template.Template
getDependencies, getFullName, getName
-
Field Details
-
factoryIdentifier_
-
encoding_
-
initializer_
-
generatedValues_
-
fixedValues_
-
constructedValues_
-
beanHandler_
-
encoder_
-
defaultResourceBundles_
-
resourceBundles_
-
attributes_
-
language_
-
defaultContentType_
-
-
Constructor Details
-
AbstractTemplate
protected AbstractTemplate()
-
-
Method Details
-
appendBlock
Description copied from interface:Template
Appends the content of a block to a value. The values used by the block will be captured when this method is called, so any future changes to template values will not affect text which was appended when this method is called.- Specified by:
appendBlock
in interfaceTemplate
- Parameters:
valueBlockId
- the ID of the value and the block- See Also:
-
appendBlock
Description copied from interface:Template
Appends the content of a block to a value. The values used by the block will be captured when this method is called, so any future changes to template values will not affect text which was appended when this method is called.- Specified by:
appendBlock
in interfaceTemplate
- Parameters:
valueId
- the ID of the valueblockId
- the ID of the block- Throws:
TemplateException
- when thevalueId
orblockId
aren't known- See Also:
-
setBlock
Description copied from interface:Template
Replaces the specified value with the content of the specified block. The values used by the block will be captured when this method is called, so any future changes to template values will not affect the specified value text.- Specified by:
setBlock
in interfaceTemplate
- Parameters:
valueBlockId
- the ID of the value and the block- Throws:
TemplateException
- when thevalueId
orblockId
aren't known- See Also:
-
setBlock
Description copied from interface:Template
Replaces the specified value with the content of the specified block. The values used by the block will be captured when this method is called, so any future changes to template values will not affect the specified value text.- Specified by:
setBlock
in interfaceTemplate
- Parameters:
valueId
- the ID of the valueblockId
- the ID of the block- Throws:
TemplateException
- when thevalueId
orblockId
aren't known- See Also:
-
getBlock
Description copied from interface:Template
Returns the evaluated content of the specified block as a text.- Specified by:
getBlock
in interfaceTemplate
- Parameters:
id
- the ID of the block in the template- Returns:
- the evaluated textual content of the specified block
- Throws:
TemplateException
- when the block ID isn't known- See Also:
-
getContent
Description copied from interface:Template
Returns the entire content of the template and finalize all non evaluated values. The content is the root block with has an empty string as identifier.Values without content will either use their default value if it has been provided, or the tag that was used to declare the value will be output as-is.
All specialized tags will also be evaluated (resource bundle localization, block localization, value renderers, ...).
- Specified by:
getContent
in interfaceTemplate
- Returns:
- the entire textual content of the template
- Throws:
TemplateException
- when an error occurred during the processing of the specialized tags- See Also:
-
writeBlock
Description copied from interface:Template
Writes the evaluated contents of the specified block to the given output stream, usingUTF-8
encoding.- Specified by:
writeBlock
in interfaceTemplate
- Parameters:
id
- the ID of the blockout
- the stream to write to- Throws:
IOException
- when errors occur during the manipulation of the output streamTemplateException
- when the block ID isn't known- See Also:
-
writeBlock
public void writeBlock(String id, OutputStream out, String charsetName) throws IOException, TemplateException - Throws:
IOException
TemplateException
-
writeContent
Description copied from interface:Template
Writes the complete evaluated template content to the given stream, using UTF-8 encoding.- Specified by:
writeContent
in interfaceTemplate
- Parameters:
out
- the stream to which the template contents should be written- Throws:
IOException
- when errors occur during the manipulation of the output streamTemplateException
- when an error occurs during the template content evaluation- See Also:
-
writeContent
public final void writeContent(OutputStream out, String charsetName) throws IOException, TemplateException Description copied from interface:Template
Writes the complete evaluated template content to the given stream, using the specified charset for encoding.- Specified by:
writeContent
in interfaceTemplate
- Parameters:
out
- the stream to which the template contents should be writtencharsetName
- the name of the charset to use- Throws:
IOException
- when errors occur during the manipulation of the output stream; orwhen the character set isn't valid
TemplateException
- when an error occurs during the template content evaluation- See Also:
-
write
Description copied from interface:Template
This method is a shorthand forTemplate.writeContent(OutputStream)
.- Specified by:
write
in interfaceTemplate
- Parameters:
out
- the stream to which the template contents should be written- Throws:
IOException
- when errors occur during the manipulation of the output stream; orwhen the character set isn't valid
TemplateException
- when an error occurs during the template content evaluation- See Also:
-
getDeferredBlock
Description copied from interface:Template
Returns the content of the specified block as a list with all the individual parts.This list is the internal representation of all content with placeholders for the values that aren't filled in yet. This structure is mainly used internally by the framework. The list structure also makes it possible to optimize performance and memory usage.
- Specified by:
getDeferredBlock
in interfaceTemplate
- Parameters:
id
- the ID of a block in this template- Returns:
- a list of the contents of the specified block
- Throws:
TemplateException
- if no such block exists; orif an error occurred during the retrieval
- See Also:
-
getDeferredContent
Description copied from interface:Template
Returns the content of this template as a list with all the individual parts.This list is the internal representation of all content with placeholders for the values that aren't filled in yet. This structure is mainly used internally by the framework. The list structure also makes it possible to optimize performance and memory usage.
- Specified by:
getDeferredContent
in interfaceTemplate
- Returns:
- a list of the contents of this template
- Throws:
TemplateException
- if an error occurred during the retrieval- See Also:
-
evaluateRenderTags
Description copied from interface:Template
Evaluates all values in this template with ID's of the form "render:class
" or "render:class:differentiator
r", where "class
" is the fully-qualified name of a class which extendsValueRenderer
, the result of callingValueRenderer.render
on a new instance of the class. The class must contain a zero-argument ("no-arg") constructor.For example, given a class
MyRenderer
in the package "org.rifers.something
", which extendsValueRenderer
, a value "render:org.rifers.something.MyRenderer:test
" would create a new instance ofMyRenderer
(using its no-arg constructor), callrender(this, "render:org.rifers.something.MyRenderer:test", "test")
, and set the value in this template to whatever value the call returns.Value renderer tags are evaluated automatically when the content is generated. You can manually call this method to force evaluation of the tags at any time.
- Specified by:
evaluateRenderTags
in interfaceTemplate
- Returns:
- the list of names of the template values that were generated
- Throws:
TemplateException
- if a class in a render tag cannot be instantiated
-
evaluateL10nTags
Description copied from interface:Template
Fills all values in this template which match "l10n:key
", where "key
" is a key in a resource bundle registered for this template. Each value will be filled with the value in the resource bundle with the corresponding key.This method is normally called automatically during template initialization. You should call it if you wish to re-evaluate the tags at any time during the template's life.
- Specified by:
evaluateL10nTags
in interfaceTemplate
- Returns:
- the list of names of the template values that were generated
-
evaluateLangTags
Description copied from interface:Template
Fills the value "lang:id
" with the value of the block "lang:id:langid
", where "id
" is the given ID, and "langid
" is this template's current language ID.If no matching block for the current language is found, the content of the specified value will not be modified.
This method is called automatically when the output is generated (such as when calling
Template.getContent()
). You can manually call this method to force evaluation of the tags earlier than that.- Specified by:
evaluateLangTags
in interfaceTemplate
- Parameters:
id
- the ID whose language tag should be filled with the appropriate block- Returns:
- the list of names of the template values that were generated
-
createInternalValue
Description copied from interface:Template
Returns an anonymous value that can be used to construct complex content for use within this template. SeeInternalValue
for details.The returned internal value is tied closely to the template it was obtained from, methods like
InternalValue.appendBlock
reference blocks within this template.- Specified by:
createInternalValue
in interfaceTemplate
- Returns:
- a new internal value instance for constructing more complex parts of this template
- See Also:
-
setValue
Description copied from interface:Template
Sets the specified value in this template to content that's structured in the internal format.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatedeferredContent
- content in the internal format- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the value of the given internal value.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templateinternalValue
- an internal value,null
set the value content to blank content- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the current content of the given template. The given template's value will be evaluated immediately, instead of being stored to be evaluated later.If the given template is
null
, the specified value will be set to an empty string.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatetemplate
- a template- Throws:
TemplateException
- if the specified value ID does not exist in this template; orif an error occurred during the evaluation of the template parameter
- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the result of callingString.valueOf
on the givenvalue
.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- an object- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template totrue
orfalse
depending on the givenvalue
.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a boolean value- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the single specified character.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a character- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given characters. The given value must not benull
.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a string of characters- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the specified range of the given character string. The specified number of bytes fromvalue
will be used, starting at the character specified byoffset
.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a character stringoffset
- the index invalue
of the first character to usecount
- the number of characters to use- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given double precision floating point value. This method uses the String.valueOf method to print the given value, which probably prints more digits than you like. You probably wantString.format
orNumberFormat
instead.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a floating point value- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given floating point value. This method uses the String.valueOf method to print the given value, which probably prints more digits than you like. You probably wantString.format
orNumberFormat
instead.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a floating point value- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given integer.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- an integer- Throws:
TemplateException
- if the specified value does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given long.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a long- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given string, or an empty string ifvalue
isnull
.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a string, ornull
- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValue
Description copied from interface:Template
Sets the specified value in this template to the given character sequence, or an empty character sequence ifvalue
isnull
.- Specified by:
setValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a character sequence, ornull
- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setValueEncoded
Description copied from interface:Template
Sets the specified value in this template to the result of callingString.valueOf
on the givenvalue
and encodes it with theTemplateEncoder
that's registered for this template- Specified by:
setValueEncoded
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- an object to will be encoded- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
setBean
Description copied from interface:Template
Sets all values in this template whose identifiers match names of properties in the given bean.For example, given a class:
class Person { private String first; private String last; public String getFirstName() { return first; } public void setFirstName(String name) { this.first = name; } public String getLastName() { return last; } public void setLastName(String name) { this.last = name; }
And given a template:
Hello <!--v firstName/--> <!--v lastName/-->.
Calling this method with an instance of Person where
first
was "Jim" andlast
was "James", would produce:Hello Jim James.
Calling this method is equivalent to calling
setValue
individually for each property of the bean.This method uses this template's encoder to encode the bean properties before setting the values. To prevent this, use the other form of setBean.
Only bean properties will be considered for insertion in the template. This means only properties with a getter and a setter will be considered.
- Specified by:
setBean
in interfaceTemplate
- Parameters:
bean
- a bean whose properties will be used to fill in values in the template- Throws:
TemplateException
- if this template has no bean handling capability; oran error occurred during the introspection of the bean
- See Also:
-
setBean
Description copied from interface:Template
Sets all values in this template whose names match names of properties in the given bean, preceded by the given prefix.For example, given a class:
class Person { private String first; private String last; public String getFirstName() { return first; } public void setFirstName(String name) { this.first = name; } public String getLastName() { return last; } public void setLastName(String name) { this.last = name; }
And given a template:
Hello <!--v NAME:firstName/--> <!--v NAME:lastName/-->.
Calling this method with an instance of Person where
first
was "Jim" andlast
was "James", and the prefix "NAME:", would produce:Hello Jim James.
Calling this method is equivalent to calling
setValue
individually for each property of the bean prefixed with the given prefix.This method uses this template's encoder to encode the bean properties before setting the values. To prevent this, use the other form of setBean.
Only bean properties will be considered for insertion in the template. This means only properties with a getter and a setter will be considered.
- Specified by:
setBean
in interfaceTemplate
- Parameters:
bean
- a bean whose properties will be used to fill in values in the templateprefix
- the prefix of values which will be filled with the given bean's property values- Throws:
TemplateException
- if this template has no bean handling capability; oran error occurred during the introspection of the bean
- See Also:
-
setBean
Description copied from interface:Template
Sets all values in this template whose names match names of properties in the given bean, preceded by the given prefix, if present. If the given prefix isnull
, it is ignored.For example, given a class:
class Person { private String first; private String last; public String getFirstName() { return first; } public void setFirstName(String name) { this.first = name; } public String getLastName() { return last; } public void setLastName(String name) { this.last = name; }
And given a template:
Hello <!--v NAME:firstName/--> <!--v NAME:lastName/-->.
Calling this method with an instance of Person where
first
was "Jim" andlast
was "James", and the prefix "NAME:", would produce:Hello Jim James.
Calling this method is equivalent to calling
setValue
individually for each property of the bean prefixed with the given prefix.If
encode
istrue
, this method will use this template's encoder to encode the bean properties before setting the values.Only bean properties will be considered for insertion in the template. This means only properties with a getter and a setter will be considered.
- Specified by:
setBean
in interfaceTemplate
- Parameters:
bean
- a bean whose properties will be used to fill in values in the templateprefix
- the prefix of values which will be filled with the given bean's property valuesencode
-true
if the bean property values have to be encoded; orfalse
otherwise- Throws:
TemplateException
- if this template has no bean handling capability; oran error occurred during the introspection of the bean
- See Also:
-
removeBean
Description copied from interface:Template
Reverts all values to their defaults when the identifiers match properties of the given bean, whether those values were set with a previous call tosetBean
. The values of the bean's properties are ignored.Calling this method is equivalent to calling
removeValue
once for the name of each property of the given bean.- Specified by:
removeBean
in interfaceTemplate
- Parameters:
bean
- a bean- Throws:
TemplateException
- if this template has no bean handling capability; oran error occurred during the introspection of the bean
- See Also:
-
removeBean
Description copied from interface:Template
Reverts all values to their defaults when the identifiers match properties of the given bean preceded by the given prefix, whether or not those values were set with a previous call tosetBean
. The values of the bean's properties are ignored.Calling this method is equivalent to calling
removeValue
once for the name of each property of the given bean, prefixed with the given prefix.- Specified by:
removeBean
in interfaceTemplate
- Parameters:
bean
- a bean whose properties will be used to determine which values to remove from the templateprefix
- a prefix- Throws:
TemplateException
- if this template has no bean handling capability; oran error occurred during the introspection of the bean
- See Also:
-
appendValue
Description copied from interface:Template
Appends the result of callingString.valueOf
on the givenvalue
to the specified value in this template.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- an object- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends"true"
or"false"
to the specified value in this template, depending on the givenvalue
.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a boolean value- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the single specified character to the specified value in this template.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a character- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the given characters to the specified value in this template. The given value must not benull
.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a string of characters- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
public final void appendValue(String id, char[] value, int offset, int count) throws TemplateException Description copied from interface:Template
Appends the specified range of the given character string to the specified value in this template. The specified number of bytes fromvalue
will be used, starting at the character specified byoffset
.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a character stringoffset
- the index invalue
of the first character to usecount
- the number of characters to use- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the given double precision floating point value to the specified value in this template. This method uses the String.valueOf method to print the given value, which probably prints more digits than you like. You probably wantString.format
orNumberFormat
instead.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a floating point value- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the given floating point value to the specified value in this template. This method uses the String.valueOf method to print the given value, which probably prints more digits than you like. You probably wantString.format
orNumberFormat
instead.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a floating point value- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the given integer to the specified value in this template.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- an integer- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the given long to the specified value in this template.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a long- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValue
Description copied from interface:Template
Appends the given string, or an empty string ifvalue
isnull
, to the specified value in this template.- Specified by:
appendValue
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- a string, ornull
- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
appendValueEncoded
Description copied from interface:Template
Appends the result of callingString.valueOf
on the givenvalue
to the specified value in this template and encodes it with theTemplateEncoder
that's registered for this template- Specified by:
appendValueEncoded
in interfaceTemplate
- Parameters:
id
- the ID of the value in this templatevalue
- an object to will be encoded- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
getValue
Description copied from interface:Template
Returns the current content of the specified value as a string.- Specified by:
getValue
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template- Returns:
- the current content value of the specified value
- Throws:
TemplateException
- if the specified value ID does not exist in this template- See Also:
-
getDefaultValue
Description copied from interface:Template
Returns the original text of the specified value, before any modification that may have been made usingTemplate.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
or similar methods.If no default value was specified for the given value, this method will return
null
.- Specified by:
getDefaultValue
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template, ornull
- Returns:
- the original text value of the specified value
- See Also:
-
hasDefaultValue
Description copied from interface:Template
Returns whether a default value was specified in this template for the specified value.- Specified by:
hasDefaultValue
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template- Returns:
- whether the specified value has a default value
- See Also:
-
getFilteredBlocks
Description copied from interface:Template
Each template type supports a set of special block tags that are used for adding automated features like localization, config value setting, ... Instead of having to parse all template block identifiers each time these features are used, RIFE filters them out at template compilation and keeps them available in a separate collection.This method is mainly used by the framework itself, the supported filter regular expressions are available from
TemplateFactory
.- Specified by:
getFilteredBlocks
in interfaceTemplate
- Parameters:
filter
- a template factory regular expression- Returns:
- a list of captured groups for matching block ID's
- See Also:
-
hasFilteredBlocks
Description copied from interface:Template
Returns whether any block matched a particular filter at template compilation.- Specified by:
hasFilteredBlocks
in interfaceTemplate
- Parameters:
filter
- a template factory regular expression- Returns:
- whether any matching blocks exist in this template
- See Also:
-
getFilteredBlock
Description copied from interface:Template
Returns the matched data of a block that matched a particular filter at template compilation.- Specified by:
getFilteredBlock
in interfaceTemplate
- Parameters:
filter
- a template factory regular expressionid
- the ID of matched block- Returns:
- the matched data; or
null
of no such filtered block was matched at template compilation time - See Also:
-
getFilteredValues
Description copied from interface:Template
Each template type supports a set of special value tags that are used for adding automated features like authentication, localization, value rendering, config value setting, ... Instead of having to parse all template value identifiers each time these features are used, RIFE filters them out at template compilation and keeps them available in a separate collection.This method is mainly used by the framework itself, the supported filter regular expressions are available from
TemplateFactory
.- Specified by:
getFilteredValues
in interfaceTemplate
- Parameters:
filter
- a template factory regular expression- Returns:
- a list of captured groups for matching value ID's
- See Also:
-
hasFilteredValues
Description copied from interface:Template
Returns whether any value matched a particular filter at template compilation.- Specified by:
hasFilteredValues
in interfaceTemplate
- Parameters:
filter
- a template factory regular expression- Returns:
- whether any matching values exist in this template
- See Also:
-
getFilteredValue
Description copied from interface:Template
Returns the matched data of a value that matched a particular filter at template compilation.- Specified by:
getFilteredValue
in interfaceTemplate
- Parameters:
filter
- a template factory regular expressionid
- the ID of matched value- Returns:
- the matched data; or
null
of no such filtered value was matched at template compilation time - See Also:
-
hasBlock
Description copied from interface:Template
Returns whether this template contains a block with the given ID. -
isValueSet
Description copied from interface:Template
Returns whether the specified value has been set. If this method returnsfalse
, the value has its original default value.If no such value exists in this template, this method will not throw an exception, it will return
false
.If the value was automatically set by RIFE2, this method will not return
true
, butTemplate.isValueGenerated(java.lang.String)
will.- Specified by:
isValueSet
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template- Returns:
- whether the specified value has been set
- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueGenerated(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
isValueGenerated
Description copied from interface:Template
Returns whether the specified value has been generated by RIFE2. This values will not be return withTemplate.isValueSet(java.lang.String)
.If no such value exists in this template, this method will not throw an exception, it will return
false
.- Specified by:
isValueGenerated
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template- Returns:
- whether the specified value has been set
- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
addGeneratedValue
Description copied from interface:Template
Registers a value IDs as being generated by RIFE2.- Specified by:
addGeneratedValue
in interfaceTemplate
- Parameters:
valueId
- the value ID to register as generated values- See Also:
-
addGeneratedValues
Description copied from interface:Template
Registers a collection of value IDs as being generated by RIFE2.- Specified by:
addGeneratedValues
in interfaceTemplate
- Parameters:
valueIds
- the value IDs to register as generated values- See Also:
-
countValues
public final int countValues()Description copied from interface:Template
Returns the number of values in this template which have been set.- Specified by:
countValues
in interfaceTemplate
- Returns:
- the number of values in this template which have been set
-
removeValue
Description copied from interface:Template
Reverts the specified value back to its default value.- Specified by:
removeValue
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.hasValueId(java.lang.String)
-
removeValues
Description copied from interface:Template
Reverts the specified values back to their default value.- Specified by:
removeValues
in interfaceTemplate
- Parameters:
ids
- the IDs of values in this template- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
removeGeneratedValues
public final void removeGeneratedValues()Description copied from interface:Template
Reverts the generated values back to their default value.- Specified by:
removeGeneratedValues
in interfaceTemplate
- See Also:
-
blankValue
Description copied from interface:Template
Set the content of the specified value to an empty string.- Specified by:
blankValue
in interfaceTemplate
- Parameters:
id
- the ID of a value in this template- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.hasValueId(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
-
clear
public final void clear()Description copied from interface:Template
Resets all values in this template and removes any resource bundles. Configuration and localization tags are re-evaluated. -
getAvailableValueIds
Description copied from interface:Template
Returns a list of the ID's of all values present in this template, including set and unset values.- Specified by:
getAvailableValueIds
in interfaceTemplate
- Returns:
- a list of ID's of all set and unset value
-
getUnsetValueIds
Description copied from interface:Template
Returns a collection of the ID's of all values in this template which have not been set.- Specified by:
getUnsetValueIds
in interfaceTemplate
- Returns:
- a collection of ID's of values in this template which have not been set
-
hasValueId
Description copied from interface:Template
Returns whether this template contains a value with the given ID.- Specified by:
hasValueId
in interfaceTemplate
- Parameters:
id
- the potential ID of a value in this template- Returns:
- whether this template contains a value with the given ID
- See Also:
-
Template.appendValue(java.lang.String, java.lang.Object)
Template.appendValueEncoded(java.lang.String, java.lang.Object)
Template.setValue(java.lang.String, java.util.List<java.lang.CharSequence>)
Template.setValueEncoded(java.lang.String, java.lang.Object)
Template.isValueSet(java.lang.String)
Template.removeValue(java.lang.String)
Template.removeValues(java.util.Collection<java.lang.String>)
Template.blankValue(java.lang.String)
Template.hasValueId(java.lang.String)
-
getModificationTime
public abstract long getModificationTime()Description copied from interface:Template
Returns when the file corresponding to this template was modified, in milliseconds since the Unix epoch.- Specified by:
getModificationTime
in interfaceTemplate
- Returns:
- the time at which the underlying template file was modified
-
appendTextInternal
-
increasePartsCapacityInternal
-
increaseValuesCapacityInternal
-
appendBlockExternalForm
-
appendBlockInternalForm
-
potentiallyEvaluateRenderTag
-
appendValueExternalForm
-
appendDefaultValueExternalForm
-
appendValueInternalForm
-
appendDefaultValueInternalForm
-
createNewInstance
Description copied from interface:Template
Creates a new template, using the same factory, name and encoding as those that were used to create this template instance.- Specified by:
createNewInstance
in interfaceTemplate
- Returns:
- a new template instance with the same parameters as this one
-
getFactoryIdentifier
Description copied from interface:Template
Returns the unique identifier of the factory that was used to instantiate this template.- Specified by:
getFactoryIdentifier
in interfaceTemplate
- Returns:
- the unique identifier of this template's factory
-
getEncoding
Description copied from interface:Template
Returns the encoding of this the content of this template.- Specified by:
getEncoding
in interfaceTemplate
- Returns:
- the encoding that was used when instantiating the template
-
getBeanHandler
Description copied from interface:Template
Returns this template's bean handler. The bean handler is used for filling bean values into template values, and for building forms.- Specified by:
getBeanHandler
in interfaceTemplate
- Returns:
- this template's bean handler
-
getFormBuilder
Description copied from interface:Template
Returns this template's form builder. The form builder can be used for generating forms and fields.- Specified by:
getFormBuilder
in interfaceTemplate
- Returns:
- this template's form builder
-
getEncoder
Description copied from interface:Template
Returns the encoder that this template uses to convert strings to values in the template's generated text output. In an HTML template, for example, this encoder may be used to convert text which may contain HTML special characters like<>
to corresponding escaped strings.- Specified by:
getEncoder
in interfaceTemplate
- Returns:
- this template's encoder
-
addResourceBundles
Description copied from interface:Template
Adds a list of resource bundles to this template. Resource bundles are used in many places, including when generating labels for forms, generating options for<select>
tags, and using localized text.- Specified by:
addResourceBundles
in interfaceTemplate
- Parameters:
resourceBundles
- a list of resource bundle- See Also:
-
addResourceBundle
Description copied from interface:Template
Adds a resource bundle to this template. Resource bundles are used in many places, including when generating labels for forms, generating options for<select>
tags, and using localized text.- Specified by:
addResourceBundle
in interfaceTemplate
- Parameters:
resourceBundle
- a resource bundle- See Also:
-
getResourceBundles
Description copied from interface:Template
Returns a list of the resource bundles used by this template. This will contain any bundles added throughaddResourceBundle
as well as any default resource bundles.- Specified by:
getResourceBundles
in interfaceTemplate
- Returns:
- a list of this template's resource bundles
- See Also:
-
hasResourceBundles
public final boolean hasResourceBundles()Description copied from interface:Template
Returns whether this template has any resource bundles registered.- Specified by:
hasResourceBundles
in interfaceTemplate
- Returns:
- whether this template contains any resource bundles
- See Also:
-
setLanguage
Description copied from interface:Template
Sets this template's current language code, such as "en".This is used when
filling localized text values
.- Specified by:
setLanguage
in interfaceTemplate
- Parameters:
lang
- a 2-letter language code for the language to be used by this template- See Also:
-
getLanguage
Description copied from interface:Template
Returns this template's current 2-letter language code. This code is used whenfilling localized text values
. If the language has not been set, it defaults to the language set by the RIFE configuration parameter "L10N_DEFAULT_LANGUAGE
".- Specified by:
getLanguage
in interfaceTemplate
- Returns:
- the 2-letter language code currently used by this template
- See Also:
-
setAttribute
Description copied from interface:Template
Sets an attribute that will be associated with this template instance.For general purpose attributes of object instances, it's recommended to use the fully qualified classname of the object as the attribute name.
- Specified by:
setAttribute
in interfaceTemplate
- Parameters:
name
- the name of the attributevalue
- the value of the attribute- See Also:
-
setAttributes
Description copied from interface:Template
Sets the given attributes to the corresponding data. Calling this method is equivalent to callingsetAttribute
for each entry in the given map.- Specified by:
setAttributes
in interfaceTemplate
- Parameters:
map
- a map of attribute names and data- See Also:
-
removeAttribute
Description copied from interface:Template
Removes an attribute from this template instance.- Specified by:
removeAttribute
in interfaceTemplate
- Parameters:
name
- the name of the attribute- See Also:
-
hasAttribute
Description copied from interface:Template
Checks whether an attribute exists in this template instance.- Specified by:
hasAttribute
in interfaceTemplate
- Returns:
true
if the attribute exists;false
otherwise- See Also:
-
getAttribute
Description copied from interface:Template
Returns the data of an attribute that was set in this template instance.- Specified by:
getAttribute
in interfaceTemplate
- Returns:
- the attribute's data; or
null
of no such attribute could be found - See Also:
-
getAttributes
Description copied from interface:Template
Returns the name and data of all attributes that have been set in this template instance.- Specified by:
getAttributes
in interfaceTemplate
- Returns:
- the attributes currently set in this template
- See Also:
-
getValueOrAttribute
Description copied from interface:Template
Returns the content of a value or the data of an attribute with a particular name.If the value with the provided name has content, it will be returned. Otherwise, if an attribute with the provided name has data, the string presentation of that will be returned. If neither are present, and a default value was provided, that will be returned. Otherwise,
null
will be returned.- Specified by:
getValueOrAttribute
in interfaceTemplate
- Parameters:
name
- the name of the value or attribute- Returns:
- the string presentation of the value or attribute with the provided name; or
null
if neither have data
-
getDefaultContentType
Description copied from interface:Template
Returns this template's default content type, for exampletext/html
.- Specified by:
getDefaultContentType
in interfaceTemplate
- Returns:
- this template's default content type; or
null
if no default content type is known for this template instance
-
setDefaultContentType
-
isTemplateClassModified
-
clone
Description copied from interface:Template
Returns a shallow copy of this template, with the same values.
-