org.openide.loaders
Class InstanceSupport.Instance

java.lang.Object
  |
  +--org.openide.loaders.InstanceSupport.Instance
All Implemented Interfaces:
InstanceCookie, InstanceCookie.Of, Node.Cookie
Enclosing class:
InstanceSupport

public static class InstanceSupport.Instance
extends Object
implements InstanceCookie.Of

Trivial supporting instance cookie for already-existing objects.


Inner classes inherited from class org.openide.cookies.InstanceCookie
InstanceCookie.Of, InstanceCookie.Origin
 
Constructor Summary
InstanceSupport.Instance(Object obj)
          Create a new instance cookie.
 
Method Summary
 Class instanceClass()
          The representation type that may be created as instances.
 Object instanceCreate()
          Create an instance.
 String instanceName()
          The name of instanceClass().
 boolean instanceOf(Class type)
          Query to found out if the object created by this cookie is instance of given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceSupport.Instance

public InstanceSupport.Instance(Object obj)
Create a new instance cookie.
Parameters:
obj - the object to represent in this cookie
Method Detail

instanceName

public String instanceName()
Description copied from interface: InstanceCookie
The name of InstanceCookie.instanceClass().
Specified by:
instanceName in interface InstanceCookie
Following copied from interface: org.openide.cookies.InstanceCookie
Returns:
the instance class name

instanceClass

public Class instanceClass()
Description copied from interface: InstanceCookie
The representation type that may be created as instances. Can be used to test whether the instance is of an appropriate class without actually creating it.
Specified by:
instanceClass in interface InstanceCookie
Following copied from interface: org.openide.cookies.InstanceCookie
Returns:
the representation class of the instance
Throws:
IOException - if an I/O error occurred
ClassNotFoundException - if a class was not found

instanceCreate

public Object instanceCreate()
Description copied from interface: InstanceCookie
Create an instance.
Specified by:
instanceCreate in interface InstanceCookie
Following copied from interface: org.openide.cookies.InstanceCookie
Returns:
the instance of type InstanceCookie.instanceClass() (or a subclass)
Throws:
IOException - if an I/O error occured
ClassNotFoundException - if a class was not found

instanceOf

public boolean instanceOf(Class type)
Description copied from interface: InstanceCookie.Of
Query to found out if the object created by this cookie is instance of given type. The same code as:
    Class actualClass = instanceClass ();
    result = type.isAsignableFrom (actualClass);
 
But this can prevent the class actualClass to be loaded into the Java VM.
Specified by:
instanceOf in interface InstanceCookie.Of
Following copied from interface: org.openide.cookies.InstanceCookie.Of
Parameters:
type - the class type we want to check
Returns:
true if this cookie can produce object of given type


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.