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 TypeMethodDescriptionvoidappendBlock(String blockId) Appends the content of a block to this value.voidappendValue(boolean value) Appends"true"or"false"to this value, depending on the givenvalue.voidappendValue(char value) Appends the single specified character to this value.voidappendValue(char[] value) Appends the given characters to this value.voidappendValue(char[] value, int offset, int count) Appends the specified range of the given character string to this value.voidappendValue(double value) Appends the given double precision floating point value to this value.voidappendValue(float value) Appends the given floating point value to this value.voidappendValue(int value) Appends the given integer to this value.voidappendValue(long value) Appends the given long to this value.voidappendValue(CharSequence value) Appends the given character sequence to this value.voidappendValue(Object value) Appends the result of callingString.valueOfon the givenvalueto this value in this template.voidappendValue(String value) Appends the given string to this value.voidappendValue(InternalValue value) Appends to this value the value of the given internal value.voidclear()Removes all content from this value.booleanbooleanisEmpty()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.valueOfon the givenvalueto 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 fromvaluewill be used, starting at the character specified byoffset.- Parameters:
value- a character stringoffset- the index invalueof 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.formatorNumberFormatinstead.- 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.formatorNumberFormatinstead.- 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 returnfalsefor 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
-