org.szegedi.expose.model
Class BooleanScalar

java.lang.Object
  |
  +--org.szegedi.expose.model.BooleanScalar
All Implemented Interfaces:
freemarker.template.TemplateModel, freemarker.template.TemplateScalarModel

public final class BooleanScalar
extends java.lang.Object
implements freemarker.template.TemplateScalarModel

Provides singleton template models for representing boolean values.

Version:
1.0
Author:
Attila Szegedi, attila@szegedi.org

Field Summary
static BooleanScalar FALSE
          TemplateScalarModel for representing boolean false value
static BooleanScalar TRUE
          TemplateScalarModel for representing boolean true value
 
Method Summary
 java.lang.String getAsString()
          "true" for the TRUE singleton, "false" for the FALSE singleton.
static boolean getBoolean(java.lang.Object 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 getScalar(boolean value)
          Returns the boolean singleton TemplateScalarModel appropriate for representing the specified boolean value.
static BooleanScalar getScalar(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 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

getScalar

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

getScalar

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

getBoolean

public static final boolean getBoolean(java.lang.Object 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.

getAsString

public java.lang.String getAsString()
"true" for the TRUE singleton, "false" for the FALSE singleton.
Specified by:
getAsString in interface freemarker.template.TemplateScalarModel

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">).
Specified by:
isEmpty in interface freemarker.template.TemplateModel