|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.beans.SimpleNumberModel
freemarker.ext.beans2
package
public class SimpleNumberModel
Holds subclasses of Number
for evaluation as
TemplateNumberModel
or unwrapped as an object.
We also implement TemplateScalarModel
so that
floats or doubles are printed with full precision.
Constructor Summary | |
---|---|
SimpleNumberModel(java.lang.Number number)
Deprecated. Constructor that takes the Number object to be wrapped. |
Method Summary | |
---|---|
long |
getAsNumber()
Deprecated. Retrieve the underlying value as a long . |
java.lang.Object |
getAsObject()
Deprecated. Retrieve the underlying object for object unwrapping purposes. |
java.lang.String |
getAsString()
Deprecated. Retrieve the underlying value as a String . |
boolean |
isEmpty()
Deprecated. Is there an underlying number in this model? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleNumberModel(java.lang.Number number)
Number
object to be wrapped.
number
- the number to be wrappedMethod Detail |
---|
public long getAsNumber() throws TemplateModelException
long
. Numbers that
use decimal places will be rounded appropriately.
getAsNumber
in interface TemplateNumberModel
TemplateModelException
public java.lang.String getAsString() throws TemplateModelException
String
. This preserves
any decimal places held in the underlying object.
getAsString
in interface TemplateScalarModel
TemplateModelException
public boolean isEmpty() throws TemplateModelException
isEmpty
in interface TemplateModel
true
if there is a Number object present, otherwise
false
TemplateModelException
public java.lang.Object getAsObject() throws TemplateModelException
getAsObject
in interface TemplateObjectModel
Number
object
TemplateModelException
- the object could not be returned
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |