|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.SimpleNumber
public class SimpleNumber
A synchronized implementation of the TemplateNumberModel
interface using a long.
All the public methods in this implementation are synchronized.
SimpleHash,
SimpleList,
SimpleScalar,
Serialized Form| Field Summary | |
|---|---|
protected boolean |
empty
Whether this SimpleNumber is currently empty. |
protected long |
numberValue
The number stored in this SimpleNumber |
| Constructor Summary | |
|---|---|
SimpleNumber()
Constructs a new SimpleNumber with a default value of 0. |
|
SimpleNumber(long numberValue)
Constructs a new SimpleNumber with the given
long value. |
|
SimpleNumber(java.lang.Number numberValue)
Constructs a new SimpleNumber with the given
Number value. |
|
SimpleNumber(java.lang.String stringValue)
Constructs a new SimpleNumber with the given
String value. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
Tests this object for equality with the given object. |
long |
getAsNumber()
Return the number value as a long. |
int |
hashCode()
Return the hash value for this object. |
boolean |
isEmpty()
Is this SimpleNumber empty? |
void |
setValue(long value)
Sets the value of this SimpleNumber |
void |
setValue(java.lang.Number value)
Sets the value of this SimpleNumber |
void |
setValue(java.lang.String stringValue)
Sets the value of this SimpleNumber to the given
String value. |
java.lang.String |
toString()
Retrieve the String value of this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected long numberValue
SimpleNumber
protected boolean empty
SimpleNumber is currently empty.
| Constructor Detail |
|---|
public SimpleNumber()
SimpleNumber with a default value of 0.
public SimpleNumber(long numberValue)
SimpleNumber with the given
long value.
numberValue - the long valuepublic SimpleNumber(java.lang.Number numberValue)
SimpleNumber with the given
Number value.
numberValue - the Number valuepublic SimpleNumber(java.lang.String stringValue)
SimpleNumber with the given
String value.
stringValue - the String to be converted to a number
java.lang.NullPointerException - the String is null
java.lang.NumberFormatException - the String could not be parsed as a long| Method Detail |
|---|
public boolean isEmpty()
throws TemplateModelException
SimpleNumber empty?
isEmpty in interface TemplateModeltrue if this object is empty, otherwise false
TemplateModelException
public long getAsNumber()
throws TemplateModelException
long.
getAsNumber in interface TemplateNumberModelTemplateModelExceptionpublic void setValue(long value)
SimpleNumber
value - the long valuepublic void setValue(java.lang.Number value)
SimpleNumber
value - the Number valuepublic void setValue(java.lang.String stringValue)
SimpleNumber to the given
String value.
stringValue - the String to be converted to a number
java.lang.NullPointerException - the String is null
java.lang.NumberFormatException - the String could not be parsed as a longpublic java.lang.String toString()
String value of this object.
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to compare against
true if the objects are equal, otherwise
falsepublic int hashCode()
hashCode in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||