freemarker.ext.beans
Class NumberModel

java.lang.Object
  extended by freemarker.ext.beans.ScalarModel
      extended by freemarker.ext.beans.NumberModel
All Implemented Interfaces:
TemplateModel, TemplateNumberModel, TemplateObjectModel, TemplateScalarModel

Deprecated. this class is deprecated in favour of the classes in the freemarker.ext.beans2 package

public final class NumberModel
extends ScalarModel
implements TemplateNumberModel

A class that will wrap a reflected parameterless method call into a TemplateNumberModel interface. It can be used directly, and is heavily used by ObjectModel to wrap properties of primitive types.

Version:
$Id: NumberModel.java 1101 2013-04-01 04:17:32Z run2000 $
Author:
Attila Szegedi, attila@szegedi.org

Constructor Summary
NumberModel(java.lang.Object object, java.lang.reflect.Method getter)
          Deprecated. Creates a new model.
 
Method Summary
 long getAsNumber()
          Deprecated. Calls the wrapped method, and calls longValue() on its return value.
 
Methods inherited from class freemarker.ext.beans.ScalarModel
getAsObject, getAsString, isEmpty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface freemarker.template.TemplateModel
isEmpty
 

Constructor Detail

NumberModel

public NumberModel(java.lang.Object object,
                   java.lang.reflect.Method getter)
Deprecated. 
Creates a new model.

Parameters:
object - the object on which the method will be called. Can be null for static methods.
getter - the method that will be called to obtain the value of the model.
Method Detail

getAsNumber

public long getAsNumber()
                 throws TemplateModelException
Deprecated. 
Calls the wrapped method, and calls longValue() on its return value.

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