ewe.reflect
Class Type

java.lang.Object
  extended byewe.reflect.Type

public class Type
extends Object

This class provides an easy way to refer to and link to a Class that may not be present at run time.

You create and use a Type object like so:

Type tp = new Type("ewe.security.Decryptor");
boolean wasFound = tp.exists();
boolean isAnInstance = tp.isInstance(anObject);


Constructor Summary
Type(String className)
          Create a Type for the specified className - which should be specified in standard "." notation.
 
Method Summary
 boolean exists()
          Return if the class of the Type was actually found.
 String getClassName()
          Return the name of the Class this Type represents.
 Reflect getReflection()
          Returns the ewe.reflect.Reflect object that represents the class, if the class was found during the construction of this Type.
 Object invoke(Object dest, String nameAndSpecs, Object[] parameters)
           
 boolean isInstance(Object obj)
          Return if the specified Object is an instance of the Class represented by this Type.
 Object newInstance()
          Return a new Instance of the class if the class exists.
 Object newInstance(String constructorSpecs, Object[] parameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Constructor Detail

Type

public Type(String className)
Create a Type for the specified className - which should be specified in standard "." notation. If the class is not found the Type will be still be created, but the isInstance() method will always return false. The exists() method can be used to check if the class actually was found.

Method Detail

newInstance

public Object newInstance()
Return a new Instance of the class if the class exists.


newInstance

public Object newInstance(String constructorSpecs,
                          Object[] parameters)

invoke

public Object invoke(Object dest,
                     String nameAndSpecs,
                     Object[] parameters)

getReflection

public Reflect getReflection()
Returns the ewe.reflect.Reflect object that represents the class, if the class was found during the construction of this Type. If the class was not found during the cunstruction, this will return null.


getClassName

public String getClassName()
Return the name of the Class this Type represents.


exists

public boolean exists()
Return if the class of the Type was actually found.


isInstance

public boolean isInstance(Object obj)
Return if the specified Object is an instance of the Class represented by this Type.

Parameters:
obj - the object to check.
Returns:
true if the object is an instance of the Class represented by this Type or false if not, or if obj is null, or if the Class for this type was not found.