站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

InstanceSupport (NetBeans Loaders API) - NetBeans API Javadoc 5.0.0

 

org.openide.loaders
Class InstanceSupport

java.lang.Object
  extended byorg.openide.loaders.InstanceSupport
All Implemented Interfaces:
InstanceCookie, InstanceCookie.Of, Node.Cookie

public class InstanceSupport
extends Object
implements InstanceCookie.Of

An instance cookie implementation that works with files or entries.


Nested Class Summary
static class InstanceSupport.Instance
          Trivial supporting instance cookie for already-existing objects.
 
Nested classes inherited from class org.openide.cookies.InstanceCookie
InstanceCookie.Of
 
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("<<ALL FILES>>", "read") java.util.PropertyPermission("*", "read")
static HelpCtx findHelp(InstanceCookie instance)
          Deprecated. use org.openide.util.HelpCtx.findHelp (Object)
 Class instanceClass()
           
 Object instanceCreate()
           
 String instanceName()
           
 boolean instanceOf(Class type)
           
 FileObject instanceOrigin()
          Returns the origin of the instance.
 boolean isApplet()
          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.
 boolean isExecutable()
          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.
 boolean isInterface()
          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.
 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

InstanceSupport

public InstanceSupport(MultiDataObject.Entry entry)
New support for given entry. The file is taken from the entry and is updated if the entry moves or renames itself.

Parameters:
entry - entry to create instance from
Method Detail

instanceName

public String instanceName()
Specified by:
instanceName in interface InstanceCookie

instanceClass

public Class instanceClass()
                    throws IOException,
                           ClassNotFoundException
Specified by:
instanceClass in interface InstanceCookie
Throws:
IOException
ClassNotFoundException

instanceOf

public boolean instanceOf(Class type)
Specified by:
instanceOf in interface InstanceCookie.Of

instanceOrigin

public FileObject instanceOrigin()
Returns the origin of the instance.

Returns:
the origin

instanceCreate

public Object instanceCreate()
                      throws IOException,
                             ClassNotFoundException
Specified by:
instanceCreate in interface InstanceCookie
Throws:
IOException
ClassNotFoundException

isApplet

public boolean isApplet()
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.

Is this an applet?

Returns:
true if this class is a java.applet.Applet

isExecutable

public boolean isExecutable()
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.

Is this a standalone executable?

Returns:
true if this class has main method (e.g., public static void main (String[] arguments)).

isJavaBean

public 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.

Is this a JavaBean?

Returns:
true if this class represents JavaBean (is public and has a public default constructor).

isInterface

public boolean isInterface()
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.

Is this an interface?

Returns:
true if the class is an interface

toString

public String toString()

findHelp

public static HelpCtx findHelp(InstanceCookie instance)
Deprecated. use org.openide.util.HelpCtx.findHelp (Object)

Find context help for some instance. Helper method useful in nodes or data objects that provide an instance cookie; they may choose to supply their own help context based on this. All API classes which can provide help contexts will be tested for (including HelpCtx instances themselves). JComponents 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.

Parameters:
instance - the instance to check for help (it is permissible for the InstanceCookie.instanceCreate() to return null)
Returns:
the help context found on the instance or inferred from a Bean, or null if none was found (or it was HelpCtx.DEFAULT_HELP)

createClassLoader

protected ClassLoader createClassLoader()
Creates new NbClassLoader with restricted PermissionCollection that contains only: java.io.FilePermission("<<ALL FILES>>", "read") java.util.PropertyPermission("*", "read")

Returns:
ClassLoader

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.