com.taco.util
Class ObjectArrayMapper

java.lang.Object
  extended by com.taco.util.ObjectArrayMapper
All Implemented Interfaces:
IObjectMapper

public class ObjectArrayMapper
extends java.lang.Object
implements IObjectMapper

An object mapper that takes a collection or a object array and converts it to an object array.


Field Summary
static ObjectArrayMapper instance
          The singleton instance of this class.
 
Constructor Summary
ObjectArrayMapper()
           
 
Method Summary
 java.lang.Object map(java.lang.Object value)
          Call toObjectArray(value).
static java.lang.Object[] toObjectArray(java.lang.Object value)
          If the argument is an instance of Object[], return it immediately.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

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

Constructor Detail

ObjectArrayMapper

public ObjectArrayMapper()
Method Detail

map

public java.lang.Object map(java.lang.Object value)
Call toObjectArray(value).

Specified by:
map in interface IObjectMapper

toObjectArray

public static final java.lang.Object[] toObjectArray(java.lang.Object value)
If the argument is an instance of Object[], return it immediately. Otherwise, if the argument is an instance of Collection, return a new array of its elements.

Parameters:
value - An instance of Object[] or Collection.
Returns:
An object array which contains the elements of value. This may be the same as value.
Throws:
java.lang.NullPointerException - if value is null
java.lang.IllegalArgumentException - if value is neither an instance of Object[] nor Collection.