com.glaivestone.javax.execution
Class ClassReference

java.lang.Object
  |
  +--com.glaivestone.javax.execution.ClassReference

public class ClassReference
extends java.lang.Object

A reference to a class which is resolved on demand.

The ClassReference mechanism enables clients to refer to classes in such a way that they can control the resolve behavior to provide for either immediate or deferred loading of the referenced class in cases when it is not already loaded in the runtime system. This is useful for dynamic configuration of the system.

Author:
Deb Lewis

Method Summary
static ClassReference create(java.lang.String className, java.lang.String description)
          Create a reference to the class identified by the fully qualified Java class name.
 java.lang.Class getReferencedClass()
          Answer the referenced class.
 boolean isResolved()
          Answer whether this reference has been resolved to the referenced class.
 void resolve()
          Resolve the reference to the class.
static java.lang.Class resolve(java.lang.String className, java.lang.String description)
          Answer the class identified by the fully qualified Java class name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static ClassReference create(java.lang.String className,
                                    java.lang.String description)
Create a reference to the class identified by the fully qualified Java class name.

Clients can force resolution at any time by sending the resolve message to the reference. The reference will be resolved on demand by the getReferencedClass message if it has not already been resolved.


resolve

public static java.lang.Class resolve(java.lang.String className,
                                      java.lang.String description)
Answer the class identified by the fully qualified Java class name.

Throws:
java.lang.IllegalArgumentException - thrown if the reference cannot be resolved to a class

getReferencedClass

public java.lang.Class getReferencedClass()
Answer the referenced class. Resolve the reference if necessary.

Throws:
java.lang.IllegalArgumentException - thrown if the reference cannot be resolved to a class

isResolved

public boolean isResolved()
Answer whether this reference has been resolved to the referenced class.


resolve

public void resolve()
Resolve the reference to the class.

May cause class loading to occur.

Throws:
java.lang.IllegalArgumentException - thrown if the reference cannot be resolved to a class

GFL 1.1 API