edu.utah.janos.nodeos
Class ClassInstantiationKey
java.lang.Object
|
+--edu.utah.janos.nodeos.ClassInstantiationKey
- public final class ClassInstantiationKey
- extends java.lang.Object
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);
}
}
- Author:
- Janos Ministry of Development
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
checkEquals
public void checkEquals(java.lang.Class c2)
throws java.lang.SecurityException
This documentation is Copyright (C) 1998-2001 The University of Utah. All Rights Reserved. See the file LICENSE for distribution terms.
Documentation, software, and mailing list archives for Janos can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/