Package rife.template
Class InternalValue
java.lang.Object
rife.template.InternalValue
An anonymous value inside a template, which is not referenced anywhere in
the template, but can be used to produce intermediate strings using the
template engine. To obtain an
InternalValue
, you should use
Template.createInternalValue()
.- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendBlock
(String blockId) Appends the content of a block to this value.void
appendValue
(boolean value) Appends"true"
or"false"
to this value, depending on the givenvalue
.void
appendValue
(char value) Appends the single specified character to this value.void
appendValue
(char[] value) Appends the given characters to this value.void
appendValue
(char[] value, int offset, int count) Appends the specified range of the given character string to this value.void
appendValue
(double value) Appends the given double precision floating point value to this value.void
appendValue
(float value) Appends the given floating point value to this value.void
appendValue
(int value) Appends the given integer to this value.void
appendValue
(long value) Appends the given long to this value.void
appendValue
(CharSequence value) Appends the given character sequence to this value.void
appendValue
(Object value) Appends the result of callingString.valueOf
on the givenvalue
to this value in this template.void
appendValue
(String value) Appends the given string to this value.void
appendValue
(InternalValue value) Appends to this value the value of the given internal value.void
clear()
Removes all content from this value.boolean
boolean
isEmpty()
Returns whether this value contains no cnotent.
-
Method Details
-
appendBlock
Appends the content of a block to this 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.- Parameters:
blockId
- the ID of the block whose value should be appended to the specified value- Throws:
TemplateException
- if the specified block does not exist in the corresponding template- Since:
- 1.0
-
appendValue
Appends to this value the value of the given internal value.- Parameters:
value
- an internal value- Since:
- 1.0
-
appendValue
Appends the result of callingString.valueOf
on the givenvalue
to this value in this template.- Parameters:
value
- an object- Since:
- 1.0
-
appendValue
public void appendValue(boolean value) Appends"true"
or"false"
to this value, depending on the givenvalue
.- Parameters:
value
- a boolean value- Since:
- 1.0
-
appendValue
public void appendValue(char value) Appends the single specified character to this value.- Parameters:
value
- a character- Since:
- 1.0
-
appendValue
public void appendValue(char[] value) Appends the given characters to this value.- Parameters:
value
- a string of characters- Since:
- 1.0
-
appendValue
public void appendValue(char[] value, int offset, int count) Appends the specified range of the given character string to this value. The specified number of bytes fromvalue
will be used, starting at the character specified byoffset
.- Parameters:
value
- a character stringoffset
- the index invalue
of the first character to usecount
- the number of characters to use- Since:
- 1.0
-
appendValue
public void appendValue(double value) Appends the given double precision floating point value to this 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.- Parameters:
value
- a floating point value- Since:
- 1.0
-
appendValue
public void appendValue(float value) Appends the given floating point value to this 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.- Parameters:
value
- a floating point value- Since:
- 1.0
-
appendValue
public void appendValue(int value) Appends the given integer to this value.- Parameters:
value
- an integer- Since:
- 1.0
-
appendValue
public void appendValue(long value) Appends the given long to this value.- Parameters:
value
- a long- Since:
- 1.0
-
appendValue
Appends the given string to this value. The given string cannot be null.- Parameters:
value
- a string- Since:
- 1.0
-
appendValue
Appends the given character sequence to this value. The given character sequence cannot be null.- Parameters:
value
- a character sequence- Since:
- 1.0
-
isEmpty
public boolean isEmpty()Returns whether this value contains no cnotent. This method will returnfalse
for newly created values as well as values for whomclear()
has just been called.- Returns:
- whether this value has no contents
- Since:
- 1.0
-
clear
public void clear()Removes all content from this value. -
equals
-