net.sf.staccatocommons.dynamic.internal
Class NullDynamic
java.lang.Object
net.sf.staccatocommons.dynamic.AbstractDynamic
net.sf.staccatocommons.dynamic.internal.NullDynamic
- All Implemented Interfaces:
- net.sf.staccatocommons.defs.Thunk<Object>, Dynamic
public class NullDynamic
- extends AbstractDynamic
- Author:
- flbulgarelli
|
Method Summary |
Dynamic |
chainingSend(String selector,
Object... args)
Sends a message to this Dynamic, as defined by
Dynamic.send(String, Object...), and returns the message result wrapped as
a dynamic, or Dynamics.null_(), if the result was
null. |
protected org.apache.commons.proxy.Invoker |
getInvoker()
|
|
send(String selector,
Object... args)
Sends a message to this Dynamic, and returns the message result
If there is no method matching for the given selector and argument count
and types, the message is said to not being understood and a
MessageNotUnderstoodException is thrown
If there exists more than one method matching the given selector and
arguments count and types, Dynamic makes no assumptions about which one
will be evaluated. |
Object |
value()
The wrapped value |
protected boolean |
valueIsInstanceOf(Class<?> clazz)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NullDynamic
public NullDynamic()
send
public <T> T send(String selector,
Object... args)
- Description copied from interface:
Dynamic
- Sends a message to this
Dynamic, and returns the message result
If there is no method matching for the given selector and argument count
and types, the message is said to not being understood and a
MessageNotUnderstoodException is thrown
If there exists more than one method matching the given selector and
arguments count and types, Dynamic makes no assumptions about which one
will be evaluated.
- Parameters:
selector - the message nameargs - the message arguments
- Returns:
- the message result
chainingSend
public Dynamic chainingSend(String selector,
Object... args)
- Description copied from interface:
Dynamic
- Sends a message to this
Dynamic, as defined by
Dynamic.send(String, Object...), and returns the message result wrapped as
a dynamic, or Dynamics.null_(), if the result was
null.
If the message is not understood, instead of throwing an exception, this
method returns the null dynamic.
This method makes chaining dynamic methods easier. Example:
Dynamics.from(anObject).$("getFoo").$("getBar").$("getBaz").value()
This will return the messages chain result, or null, if any message of the
chain returned null or was not understood
- Returns:
- the null dynamic if the message was not understood or if answered
null. The message result, wrapped as a Dynamic,
otherwise. - See Also:
Dynamics.null_()
value
public Object value()
- Description copied from interface:
Dynamic
- The wrapped value
valueIsInstanceOf
protected boolean valueIsInstanceOf(Class<?> clazz)
- Overrides:
valueIsInstanceOf in class AbstractDynamic
getInvoker
protected org.apache.commons.proxy.Invoker getInvoker()
- Overrides:
getInvoker in class AbstractDynamic
Copyright © 2010-2011 Staccato-Commons. All Rights Reserved.