|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openide.loaders.InstanceSupport
An instance cookie implementation that works with files or entries.
Inner Class Summary | |
static class |
InstanceSupport.Instance
Trivial supporting instance cookie for already-existing objects. |
static class |
InstanceSupport.Origin
Enhanced instance cookie support that also knows the file it has been created from and can be serialized back to. |
Inner classes inherited from class org.openide.cookies.InstanceCookie |
InstanceCookie.Of, InstanceCookie.Origin |
Constructor Summary | |
InstanceSupport(MultiDataObject.Entry entry)
New support for given entry. |
Method Summary | |
protected ClassLoader |
createClassLoader()
Creates new NbClassLoader with restricted PermissionCollection that contains only: java.io.FilePermission("< |
static HelpCtx |
findHelp(InstanceCookie instance)
Find context help for some instance. |
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. |
FileObject |
instanceOrigin()
Returns the origin of the instance. |
boolean |
isApplet()
Is this an applet? |
boolean |
isExecutable()
Is this a standalone executable? |
boolean |
isInterface()
Is this an interface? |
boolean |
isJavaBean()
Deprecated. This method probably should not be used, as it catches a variety of potentially serious exceptions and errors, and swallows them so as to produce a simple boolean result. (Notifying them all would be inappropriate as they typically come from user code.) Better to directly parse the bytecode, using e.g. the classfile module, which is immune to this class of errors. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public InstanceSupport(MultiDataObject.Entry entry)
entry
- entry to create instance fromMethod Detail |
public String instanceName()
InstanceCookie
InstanceCookie.instanceClass()
.instanceName
in interface InstanceCookie
org.openide.cookies.InstanceCookie
public Class instanceClass() throws IOException, ClassNotFoundException
InstanceCookie
instanceClass
in interface InstanceCookie
org.openide.cookies.InstanceCookie
IOException
- if an I/O error occurredClassNotFoundException
- if a class was not foundpublic boolean instanceOf(Class type)
InstanceCookie.Of
Class actualClass = instanceClass (); result = type.isAsignableFrom (actualClass);But this can prevent the class
actualClass
to be
loaded into the Java VM.instanceOf
in interface InstanceCookie.Of
org.openide.cookies.InstanceCookie.Of
type
- the class type we want to checkpublic FileObject instanceOrigin()
InstanceCookie.Origin#instanceOrigin
public Object instanceCreate() throws IOException, ClassNotFoundException
InstanceCookie
instanceCreate
in interface InstanceCookie
org.openide.cookies.InstanceCookie
InstanceCookie.instanceClass()
(or a subclass)IOException
- if an I/O error occuredClassNotFoundException
- if a class was not foundpublic boolean isApplet()
true
if this class is an Applet
public boolean isExecutable()
true
if this class has main method
(e.g., public static void main (String[] arguments)
).public boolean isJavaBean()
true
if this class represents JavaBean (is public and has a public default constructor).public boolean isInterface()
true
if the class is an interfacepublic String toString()
toString
in class Object
public static HelpCtx findHelp(InstanceCookie instance)
HelpCtx
instances themselves).
JComponent
s are checked for an attached help ID property,
as with HelpCtx.findHelp(java.awt.Component)
(but not traversing parents).
Also, partial compliance with the JavaHelp section on JavaBeans help is implemented--i.e.,
if a Bean in its BeanInfo
provides a BeanDescriptor
which
has the attribute helpID
, this will be returned. The value is not
defaulted (because it would usually be nonsense and would mask a useful default
help for the instance container), nor is the help set specification checked,
since someone should have installed the proper help set anyway, and the APIs
cannot add a new reference to a help set automatically.
See javax.help.HelpUtilities.getIDStringFromBean
for details.
Special IDs are added, corresponding to the class name, for all standard visual components.
instance
- the instance to check for help (it is permissible for the InstanceCookie.instanceCreate()
to return null
)null
if none was found (or it was HelpCtx.DEFAULT_HELP
)protected ClassLoader createClassLoader()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |