freemarker.ext.beans2
Class NumberWrapper

java.lang.Object
  extended by freemarker.ext.beans2.NumberWrapper
All Implemented Interfaces:
ObjectWrapper, TemplateModel, TemplateNumberModel, TemplateObjectModel, TemplateScalarModel, java.io.Serializable, java.lang.Cloneable

public class NumberWrapper
extends java.lang.Object
implements TemplateNumberModel, TemplateScalarModel, TemplateObjectModel, ObjectWrapper, java.io.Serializable

Since:
1.9
Version:
$Id: NumberWrapper.java 1164 2005-10-09 11:57:04Z run2000 $
Author:
Nicholas Cull
See Also:
Serialized Form

Constructor Summary
NumberWrapper()
           
NumberWrapper(java.lang.Number object)
           
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 long getAsNumber()
          Returns the number's value as a long.
 java.lang.Object getAsObject()
          Return the underlying object to the reflection mechanism in the freemarker.ext.beans package.
 java.lang.String getAsString()
          Returns the scalar's value as a String.
 boolean isEmpty()
          Is the object empty?
 void setObject(java.lang.Object object)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberWrapper

public NumberWrapper()

NumberWrapper

public NumberWrapper(java.lang.Number object)
Method Detail

setObject

public void setObject(java.lang.Object object)
Specified by:
setObject in interface ObjectWrapper

isEmpty

public boolean isEmpty()
                throws TemplateModelException
Description copied from interface: TemplateModel
Is the object empty?

Specified by:
isEmpty in interface TemplateModel
Returns:
true if this object is empty, otherwise false
Throws:
TemplateModelException

getAsString

public java.lang.String getAsString()
                             throws TemplateModelException
Description copied from interface: TemplateScalarModel
Returns the scalar's value as a String.

Specified by:
getAsString in interface TemplateScalarModel
Returns:
the String value of this scalar.
Throws:
TemplateModelException

getAsNumber

public long getAsNumber()
                 throws TemplateModelException
Description copied from interface: TemplateNumberModel
Returns the number's value as a long.

Specified by:
getAsNumber in interface TemplateNumberModel
Returns:
the long value of this scalar.
Throws:
TemplateModelException

getAsObject

public java.lang.Object getAsObject()
                             throws TemplateModelException
Description copied from interface: TemplateObjectModel
Return the underlying object to the reflection mechanism in the freemarker.ext.beans package. Any variables, methods or properties can be called directly via reflection.

Specified by:
getAsObject in interface TemplateObjectModel
Returns:
the underlying object for this template model
Throws:
TemplateModelException - the object could not be returned

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Specified by:
clone in interface ObjectWrapper
Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.
Throws:
java.lang.RuntimeException - the clone operation was not successful
java.lang.OutOfMemoryError - if there is not enough memory.
See Also:
Cloneable