com.thoughtworks.proxy.toys.nullobject
Class Null

java.lang.Object
  extended by com.thoughtworks.proxy.toys.nullobject.Null

public class Null
extends Object

Toy factory to create proxies acting as Null Objects.

Since:
0.1
Author:
Dan North, Aslak Hellesøy
See Also:
com.thoughtworks.proxy.toys.nullobject

Field Summary
static Object NULL_OBJECT
          The Null Object.
static SortedMap NULL_SORTED_MAP
          Immutable Null Object implementation of SortedMap
static SortedSet NULL_SORTED_SET
          Immutable Null Object implementation of SortedSet
 
Method Summary
static boolean isNullObject(Object object)
          Determine whether an object was created by object(Class).
static boolean isNullObject(Object object, ProxyFactory proxyFactory)
          Determine whether an object was created by object(Class, ProxyFactory).
static Object object(Class type)
          Generate a Null Object proxy for a specific type using the StandardProxyFactory.
static Object object(Class type, ProxyFactory proxyFactory)
          Generate a Null Object proxy for a specific type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_OBJECT

public static final Object NULL_OBJECT
The Null Object.


NULL_SORTED_MAP

public static final SortedMap NULL_SORTED_MAP
Immutable Null Object implementation of SortedMap


NULL_SORTED_SET

public static final SortedSet NULL_SORTED_SET
Immutable Null Object implementation of SortedSet

Method Detail

object

public static Object object(Class type,
                            ProxyFactory proxyFactory)
Generate a Null Object proxy for a specific type.

Note that the method will only return a proxy if it cannot handle the type itself or null if the type cannot be proxied.

Parameters:
type - the type implemented by the proxy
proxyFactory - the ProxyFactory in use
Returns:
object, proxy or null
Since:
0.1
See Also:
com.thoughtworks.proxy.toys.nullobject

object

public static Object object(Class type)
Generate a Null Object proxy for a specific type using the StandardProxyFactory.

Note that the method will only return a proxy if it cannot handle the type itself or null if the type cannot be proxied.

Parameters:
type - the type implemented by the proxy
Returns:
object, proxy or null
Since:
0.1
See Also:
com.thoughtworks.proxy.toys.nullobject

isNullObject

public static boolean isNullObject(Object object)
Determine whether an object was created by object(Class).

Parameters:
object - the object to examine
Returns:
true if the object is a Null proxy.
Since:
0.1

isNullObject

public static boolean isNullObject(Object object,
                                   ProxyFactory proxyFactory)
Determine whether an object was created by object(Class, ProxyFactory).

Parameters:
object - the object to examine
proxyFactory - the ProxyFactory to use
Returns:
true if the object is a Null proxy.
Since:
0.1