net.sf.staccatocommons.dynamic
Class AbstractDynamic
java.lang.Object
net.sf.staccatocommons.dynamic.AbstractDynamic
- All Implemented Interfaces:
- net.sf.staccatocommons.defs.Thunk<Object>, Dynamic
- Direct Known Subclasses:
- NullDynamic, ReflectiveDynamic
public abstract class AbstractDynamic
- extends Object
- implements Dynamic
- Author:
- flbulgarelli
|
Field Summary |
protected static org.apache.commons.proxy.invoker.NullInvoker |
NULL_INVOKER
|
protected static org.apache.commons.proxy.factory.javassist.JavassistProxyFactory |
PROXY_FACTORY
|
|
Method Summary |
Dynamic |
$(String selector,
Object... args)
Synonym for Dynamic.chainingSend(String, Object...) |
|
as(Class<T> clazz)
"casts" this dynamic to the desired type, by returning the wrapped value,
if it can be casted to the given class, or by returning a proxy that
forwards messages to Dynamic.send(String, Object...), otherwise. |
|
chainingAs(Class<T> clazz)
"casts" this dynamic to the desired type, by returning the wrapped value,
if it can be casted to the given class, or by returning a proxy that
forwards messages to Dynamic.chainingSend(String, Object...), casting with
Dynamic.chainingAs(Class) the result to the desired method return type,
otherwise. |
<T> net.sf.staccatocommons.defs.Thunk<T> |
|
delayedSend(String selector,
Object... args)
Asynchronously sends a message to this dynamic object by returning a thunk
that, when evaluated, performs the actual message passing |
protected org.apache.commons.proxy.Invoker |
getInvoker()
|
protected boolean |
valueIsInstanceOf(Class<?> clazz)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROXY_FACTORY
protected static final org.apache.commons.proxy.factory.javassist.JavassistProxyFactory PROXY_FACTORY
NULL_INVOKER
protected static final org.apache.commons.proxy.invoker.NullInvoker NULL_INVOKER
AbstractDynamic
public AbstractDynamic()
$
public final Dynamic $(String selector,
Object... args)
- Description copied from interface:
Dynamic
- Synonym for
Dynamic.chainingSend(String, Object...)
- Specified by:
$ in interface Dynamic
- Returns:
Dynamic.chainingSend(String, Object...)
delayedSend
@NonNull
public final <T> net.sf.staccatocommons.defs.Thunk<T> delayedSend(@NonNull
String selector,
@NonNull
Object... args)
- Description copied from interface:
Dynamic
- Asynchronously sends a message to this dynamic object by returning a thunk
that, when evaluated, performs the actual message passing
- Specified by:
delayedSend in interface Dynamic
- Parameters:
selector - the message selectorargs - the message arguments
- Returns:
- a thunk that, when evaluted, will send the given message
as
@NonNull
public final <T> T as(@NonNull
Class<T> clazz)
- Description copied from interface:
Dynamic
- "casts" this dynamic to the desired type, by returning the wrapped value,
if it can be casted to the given class, or by returning a proxy that
forwards messages to
Dynamic.send(String, Object...), otherwise.
Methods must throw ClassCastException if the
actual returned value of the dynamic can not be cast the the returned value
of the method, and NullPointerException if null is returned when a
primitive return type is expected
- Specified by:
as in interface Dynamic
- Returns:
- a new proxy of the given type, that forwards messages to this
Dynamic
chainingAs
@NonNull
public final <T> T chainingAs(@NonNull
Class<T> clazz)
- Description copied from interface:
Dynamic
- "casts" this dynamic to the desired type, by returning the wrapped value,
if it can be casted to the given class, or by returning a proxy that
forwards messages to
Dynamic.chainingSend(String, Object...), casting with
Dynamic.chainingAs(Class) the result to the desired method return type,
otherwise.
Methods must throw NullPointerException if null is
returned when a primitive return type is expected
- Specified by:
chainingAs in interface Dynamic
- Returns:
- a new proxy of the given type, that forwards messages to this
Dynamic
valueIsInstanceOf
protected boolean valueIsInstanceOf(Class<?> clazz)
getInvoker
protected org.apache.commons.proxy.Invoker getInvoker()
Copyright © 2010-2011 Staccato-Commons. All Rights Reserved.