freemarker.ext.beans
Class BooleanScalar

java.lang.Object
  |
  +--freemarker.ext.beans.BeanModelBase
        |
        +--freemarker.ext.beans.BeanModel
              |
              +--freemarker.ext.beans.BooleanScalar
All Implemented Interfaces:
TemplateHashModel, TemplateModel, TemplateScalarModel

public final class BooleanScalar
extends BeanModel

Provides singleton template models for representing boolean values.

Version:
1.0
Author:
Attila Szegedi, szegedia@freemail.hu

Field Summary
static BooleanScalar FALSE
          TemplateScalarModel for representing boolean false value
static BooleanScalar TRUE
          TemplateScalarModel for representing boolean true value
 
Fields inherited from class freemarker.ext.beans.BeanModel
TYPE_ARRAY, TYPE_COLLECTION, TYPE_ENUMERATION, TYPE_ITERATOR, TYPE_MAP, TYPE_OBJECT, TYPE_OBJECT_BASE, TYPE_RESOURCE_BUNDLE
 
Method Summary
static boolean getBoolean(TemplateModel value)
          Returns true if the passed object is the TRUE singleton.
static java.lang.Boolean getBooleanObject(java.lang.Object value)
          Returns Boolean.TRUE if the passed object is the TRUE singleton, otherwise returns Boolean.FALSE.
static BooleanScalar getInstance(boolean value)
          Returns the boolean singleton TemplateScalarModel appropriate for representing the specified boolean value.
static BooleanScalar getInstance(java.lang.Boolean value)
          Returns the boolean singleton TemplateScalarModel appropriate for representing the specified boolean value.
 boolean isEmpty()
          Returns true if this is the FALSE object.
 
Methods inherited from class freemarker.ext.beans.BeanModel
get, getAsString, getInstance, getInstance, getObject, getType, invokeGenericGet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final BooleanScalar TRUE
TemplateScalarModel for representing boolean true value

FALSE

public static final BooleanScalar FALSE
TemplateScalarModel for representing boolean false value
Method Detail

getInstance

public static final BooleanScalar getInstance(boolean value)
Returns the boolean singleton TemplateScalarModel appropriate for representing the specified boolean value.

getInstance

public static final BooleanScalar getInstance(java.lang.Boolean value)
Returns the boolean singleton TemplateScalarModel appropriate for representing the specified boolean value.

getBoolean

public static final boolean getBoolean(TemplateModel value)
Returns true if the passed object is the TRUE singleton.

getBooleanObject

public static final java.lang.Boolean getBooleanObject(java.lang.Object value)
Returns Boolean.TRUE if the passed object is the TRUE singleton, otherwise returns Boolean.FALSE.

isEmpty

public boolean isEmpty()
Returns true if this is the FALSE object. As the Expression.isTrue() returns true if the model is !isEmpty(), this allows for usual semantics of booleans (you can write <if cond> instead of <if cond == "true">).
Overrides:
isEmpty in class freemarker.ext.beans.BeanModelBase
Following copied from interface: freemarker.template.TemplateModel
Returns:
true if this object is empty.