All Packages This Package Class Hierarchy Class Search Index
Class edu.utah.janos.core.ClassInstantiationKey
java.lang.Object
|
+----edu.utah.janos.core.ClassInstantiationKey
public final class ClassInstantiationKey
extends java.lang.Object
{
// Fields 1
private final Class c1;
// Constructors 1
ClassInstantiationKey(Class);
// Methods 1
public void checkEquals(Class) throws SecurityException;
}
Blaouaufngg. Janos uses reflection to instantiate the first object
in a flow, so that the object can't have pointers to objects in
other flows. Unfortunately, the object's class usually belongs to
another package, so it must be public and have a public constructor
in order for JDK1.1-style reflection to work. But this means anyone
can instantiate the class, which may not be desirable. To prevent
this, Janos passes a ClassInstantiationKey into the constructor (if
there is a constructor taking one ClassInstantiationKey as an argument),
and the constructor verifies that the key matches its own class:
public class Foo
{
public Foo(ClassInstantiationKey key) throws SecurityException
{
key.checkEquals(Foo.class);
}
}
private final Class c1
ClassInstantiationKey(Class c1)
public void checkEquals(Class c2) throws SecurityException
All Packages This Package Class Hierarchy Class Search Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7