net.sf.staccatocommons.dynamic
Class Dynamics

java.lang.Object
  extended by net.sf.staccatocommons.dynamic.Dynamics

public class Dynamics
extends Object

Class methods for creating simple Dynamics

Author:
flbulgarelli

Constructor Summary
Dynamics()
           
 
Method Summary
static Dynamic from(Object object)
          Answers a new Dynamic wrapper for the given object, that uses reflection to invoke methods, and property descriptors to get
static Dynamic fromClass(Class<?> clazz)
          Answer a new Dynamic that wraps a new instance of the given class
static Dynamic fromClassName(String classname)
          Answer a new Dynamic that wraps a new instance of a class for its given classname
static Dynamic null_()
          Answers the null Dynamic, that is, a Dynamic that understands all messages, by doing nothing and returning null.
static Dynamic nullSafeFrom(Object object)
          Answers a new Dynamic wrapper for the given object, if it is not null, or null_() otherwise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dynamics

public Dynamics()
Method Detail

from

@NonNull
public static Dynamic from(@NonNull
                                   Object object)
Answers a new Dynamic wrapper for the given object, that uses reflection to invoke methods, and property descriptors to get

Parameters:
object -
Returns:
a new Dynamic

nullSafeFrom

@NonNull
public static Dynamic nullSafeFrom(Object object)
Answers a new Dynamic wrapper for the given object, if it is not null, or null_() otherwise

Parameters:
object -
Returns:
a new Dynamic, or null_(), if the object is null

null_

@Constant
public static Dynamic null_()
Answers the null Dynamic, that is, a Dynamic that understands all messages, by doing nothing and returning null. Its Dynamic.value() is null

Returns:
the null dynamic

fromClassName

public static Dynamic fromClassName(@NonNull
                                    String classname)
Answer a new Dynamic that wraps a new instance of a class for its given classname

Parameters:
classname - the class name
Returns:
a new Dynamic wrapper for a new instance of the given class
Throws:
InstantiationFailedException - if class can not be instantiated

fromClass

@NonNull
public static Dynamic fromClass(@NonNull
                                        Class<?> clazz)
Answer a new Dynamic that wraps a new instance of the given class

Parameters:
clazz - the class to instantiate
Returns:
a new Dynamic wrapper for a new instance of the given class
Throws:
InstantiationFailedException - if class can not be instantiated


Copyright © 2010-2011 Staccato-Commons. All Rights Reserved.