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

InstanceCookie (Nodes API) - NetBeans API Javadoc (Current Development Version)

org.openide.nodes 7.0

org.openide.cookies
Interface InstanceCookie

All Superinterfaces:
Node.Cookie
All Known Subinterfaces:
InstanceCookie.Of

public interface InstanceCookie
extends Node.Cookie

Cookie that should be provided by all nodes that are able to create a "instance". Generally this is used to register objects declaratively in XML layers.


Nested Class Summary
static interface InstanceCookie.Of
          Enhanced cookie that can answer queries about the type of the instance it creates.
 
Method Summary
 Class<?> instanceClass()
          The type that the instance is expected to be assignable to.
 Object instanceCreate()
          Create an instance.
 String instanceName()
          The name of instanceClass().
 

Method Detail

instanceName

String instanceName()
The name of instanceClass(). Should be the same as instanceClass().getName() but may be able to avoid actually loading the class.

Returns:
the instance class name

instanceClass

Class<?> instanceClass()
                       throws IOException,
                              ClassNotFoundException
The type that the instance is expected to be assignable to. Can be used to test whether the instance is of an appropriate class without actually creating it.

Returns:
the type (or perhaps some interesting supertype) of the instance
Throws:
IOException - if metadata about the instance could not be read, etc.
ClassNotFoundException - if the instance type could not be loaded

instanceCreate

Object instanceCreate()
                      throws IOException,
                             ClassNotFoundException
Create an instance.

Returns:
an object assignable to instanceClass()
Throws:
IOException - for the same reasons as instanceClass(), or an object could not be deserialized, etc.
ClassNotFoundException - for the same reasons as instanceClass()

org.openide.nodes 7.0

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