com.taco.util
Class BooleanMapper

java.lang.Object
  extended by com.taco.util.BooleanMapper
All Implemented Interfaces:
IObjectMapper, java.io.Serializable

public final class BooleanMapper
extends java.lang.Object
implements IObjectMapper, java.io.Serializable

An implementation of IObjectMapper that returns a Boolean which represents an object.

See Also:
Serialized Form

Field Summary
static BooleanMapper instance
          The singleton instance of this class.
 
Method Summary
 java.lang.Object map(java.lang.Object obj)
          If obj is null, return FALSE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final BooleanMapper instance
The singleton instance of this class.

Method Detail

map

public java.lang.Object map(java.lang.Object obj)
If obj is null, return FALSE. If obj is a Boolean, return obj itself. If obj is an instance of Number, return FALSE iff the int value of obj is 0. If obj is an instance of CharSequence or Object[], return FALSE iff the length is 0. If obj is an instance of Collection or Map, return FALSE iff the size is 0. Otherwise, return TRUE. One tricky point: if obj is "false", this method still returns TRUE since obj is non-empty.

Specified by:
map in interface IObjectMapper