public class NullObject extends GroovyObjectSupport
Type Params | Return Type | Name and description |
---|---|---|
|
public boolean |
asBoolean() A null object coerces to false. |
|
public Object |
asType(Class c) Type conversion method for null. |
|
public Object |
clone() Since this is implemented as a singleton, avoid the use of the clone method. |
|
public boolean |
equals(Object o) null is only equal to null. |
|
public static NullObject |
getNullObject() Returns the NullObject reference. |
|
public Object |
getProperty(String name) Tries to get a property on null, which fails. |
|
public int |
hashCode()
|
|
public Object |
invokeMethod(String name, Object arguments) Tries to invoke a method on null, which falis. |
|
public boolean |
is(Object o) Tests for equal references. |
|
public Iterator |
iterator() Provides ability to iterate on null. |
|
public Object |
plus(Object o) Fallback for null+null . |
|
public Object |
plus(String s) Allows to add a String to null. |
|
public void |
setProperty(String name, Object value) Tries to set a property on null, which fails. |
|
public String |
toString() |
<T> |
public T |
with(Closure<T> closure) Allows the closure to be called for NullObject. |
Methods inherited from class | Name |
---|---|
class GroovyObjectSupport |
getMetaClass, setMetaClass |
A null object coerces to false.
Since this is implemented as a singleton, avoid the use of the clone method.
null is only equal to null.
o
- the reference object with which to compareReturns the NullObject reference.
Tries to get a property on null, which fails.
Tries to invoke a method on null, which falis.
Tests for equal references.
Provides ability to iterate on null.
Fallback for null+null
. The plus(java.lang.String) variant catches
the case of adding a non-null String to null.
Allows to add a String to null. The result is concatenated String of the result of calling toString() on this object and the String in the parameter.
Tries to set a property on null, which fails.
Allows the closure to be called for NullObject.
closure
- the closure to call on the object