org.millscript.millscript.datatypes
Class ListFactory

java.lang.Object
  extended by org.millscript.millscript.datatypes.ListFactory

public abstract class ListFactory
extends java.lang.Object

This is a utility class for constructing lists from objects.


Method Summary
static org.millscript.commons.util.IList make(java.lang.Object obj)
          Returns a list made from the specified object.
static boolean sameAs(java.lang.Object x, java.lang.Object y)
          Checks if the two specified arguments are of the same type, but only for list compatible types.
static java.lang.Object unmake(java.lang.Object obj, org.millscript.commons.util.IList<?> x)
          Returns an object of the specified type, made from the specified list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

make

public static final org.millscript.commons.util.IList make(java.lang.Object obj)
Returns a list made from the specified object.

Parameters:
obj - the object to make a list from
Returns:
a List made from the specified object

sameAs

public static final boolean sameAs(java.lang.Object x,
                                   java.lang.Object y)
Checks if the two specified arguments are of the same type, but only for list compatible types.

Parameters:
x - first object to compare
y - second object to compare
Returns:
true if both objects are of the same type and list compatible, false otherwise

unmake

public static final java.lang.Object unmake(java.lang.Object obj,
                                            org.millscript.commons.util.IList<?> x)
Returns an object of the specified type, made from the specified list. This operation is essentially the reverse of the make method, above. e.g. if the target type is a String, the list is taken to be a list of characters making up a new string.

Parameters:
obj - the target object type
x - the list of constituent parts
Returns:
an object of the target type, made from the specified list


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.