|
org.openide.src 1.8.31 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.src.Element org.openide.src.MemberElement org.openide.src.ClassElement
public final class ClassElement
Element that describes one class. Note that this is a member element--in fact, it may be either a top-level class (held in a source element), or a named inner class (held in another class element).
Note: If you add an element to a ClassElement, the ClassElement crates its own copy of the passed element. If you perform subsequent modifications to the object passed to addMethod (addField, addWhatever), the original element will be updated, not the one created as a result of the add() operation.
Nested Class Summary | |
---|---|
static interface |
ClassElement.Finder
Provides a "finder" for class elements. |
static interface |
ClassElement.Impl
Pluggable behavior for class elements. |
Nested classes/interfaces inherited from class org.openide.src.Element |
---|
Element.Impl2 |
Field Summary | |
---|---|
static boolean |
CLASS
Constant indicating that the class is a real class. |
static boolean |
INTERFACE
Constant indicating that the class is an interface. |
static Identifier |
ROOT_OBJECT
Default class to extend. |
Fields inherited from class org.openide.src.Element |
---|
impl, impl2 |
Fields inherited from interface org.openide.src.ElementProperties |
---|
PROP_ALL_CLASSES, PROP_BODY, PROP_CLASS_OR_INTERFACE, PROP_CLASSES, PROP_CONSTRUCTORS, PROP_EXCEPTIONS, PROP_FIELDS, PROP_IMPORTS, PROP_INIT_VALUE, PROP_INITIALIZERS, PROP_INTERFACES, PROP_JAVADOC, PROP_MEMBERS, PROP_METHODS, PROP_MODIFIERS, PROP_NAME, PROP_PACKAGE, PROP_PARAMETERS, PROP_RETURN, PROP_STATIC, PROP_STATUS, PROP_SUPERCLASS, PROP_TYPE, PROP_VALID |
Constructor Summary | |
---|---|
ClassElement()
Create a new class element in memory. |
|
ClassElement(ClassElement.Impl impl,
ClassElement clazz)
Factory constructor for defining embedded classes. |
|
ClassElement(ClassElement.Impl impl,
SourceElement source)
Factory constructor for defining top level classes. |
Method Summary | |
---|---|
void |
addClass(ClassElement el)
Add a new inner class to this class. |
void |
addClasses(ClassElement[] els)
Add some new inner classes to this class. |
void |
addConstructor(ConstructorElement el)
Add a constructor to this class. |
void |
addConstructors(ConstructorElement[] els)
Add some constructors to this class. |
void |
addField(FieldElement el)
Add a new field to the class. |
void |
addFields(FieldElement[] els)
Add some new fields to the class. |
void |
addInitializer(InitializerElement el)
Add a new initializer block to this class. |
void |
addInitializers(InitializerElement[] els)
Add some initializer blocks to this class. |
void |
addInterface(Identifier in)
Add an interface to this class. |
void |
addInterfaces(Identifier[] ins)
Add some interfaces to this class. |
void |
addMethod(MethodElement el)
Add a method to this class. |
void |
addMethods(MethodElement[] els)
Add some methods to this class. |
Object |
clone()
Clone this element. |
static ClassElement |
forClass(Class clazz)
Deprecated. This method variant can no longer work. Use forClass(Class,FileObject) instead. |
static ClassElement |
forClass(Class clazz,
FileObject reference)
Search for a class element throughout the system. |
static ClassElement |
forName(String name)
Deprecated. This method variant can no longer work. Use forName(String,FileObject) instead. |
static ClassElement |
forName(String name,
FileObject reference)
Search for a class element throughout the system. |
ClassElement |
getClass(Identifier name)
Find an inner class by name. |
ClassElement[] |
getClasses()
Get all inner classes for this class. |
ConstructorElement |
getConstructor(Type[] arguments)
Find a constructor by signature. |
ConstructorElement[] |
getConstructors()
Get all constructors in this class. |
FieldElement |
getField(Identifier name)
Find a field by name. |
FieldElement[] |
getFields()
Get all fields in this class. |
InitializerElement[] |
getInitializers()
Get all the initializer blocks for this class. |
Identifier[] |
getInterfaces()
Get all interfaces for this class. |
JavaDoc.Class |
getJavaDoc()
Get the class documentation. |
MethodElement |
getMethod(Identifier name,
Type[] arguments)
Find a method by signature. |
MethodElement[] |
getMethods()
Get all methods in this class. |
int |
getModifiersMask()
Get the permitted modifiers for this type of element. |
String |
getSignature()
Returns the signature of the class as used internally in the JVM. |
SourceElement |
getSource()
Get the source element of this class. |
Identifier |
getSuperclass()
Get the superclass of this class. |
String |
getVMName()
Creates a name of the class usable in the JVM. |
boolean |
hasMainMethod()
Test whether this class has a declared main method and so may be executed directly. |
boolean |
isClass()
Test whether this is really a class. |
boolean |
isClassOrInterface()
Test whether this is really a class, or an interface. |
boolean |
isDeclaredAsApplet()
Test whether this class is an applet. |
boolean |
isDeclaredAsJavaBean()
Test whether this class is a JavaBean. |
boolean |
isInner()
Test if this is an inner class. |
boolean |
isInterface()
Test whether this is an interface. |
void |
print(ElementPrinter printer)
Print this element (and all its subelements) into an element printer. |
static void |
register(ClassElement.Finder f)
Register a new finder for locating class elements. |
void |
removeClass(ClassElement el)
Remove an inner class from this class. |
void |
removeClasses(ClassElement[] els)
Remove some inner classes from this class. |
void |
removeConstructor(ConstructorElement el)
Remove a constructor from this class. |
void |
removeConstructors(ConstructorElement[] els)
Remove some constructors from this class. |
void |
removeField(FieldElement el)
Remove a field from the class. |
void |
removeFields(FieldElement[] els)
Remove some fields from the class. |
void |
removeInitializer(InitializerElement el)
Remove an initializer block from this class. |
void |
removeInitializers(InitializerElement[] els)
Remove some initializer blocks from this class. |
void |
removeInterface(Identifier in)
Remove an interface from this class. |
void |
removeInterface(Identifier[] ins)
Deprecated. the method's name is incorrect; please use removeInterfaces(ins) instead. |
void |
removeInterfaces(Identifier in)
Deprecated. the method's name is incorrect; please use removeInterface(i) instead. |
void |
removeInterfaces(Identifier[] ins)
Remove some interfaces from this class. |
void |
removeMethod(MethodElement el)
Remove a method from this class. |
void |
removeMethods(MethodElement[] els)
Remove some methods from this class. |
void |
setClasses(ClassElement[] els)
Set the inner classes for this class. |
void |
setClassOrInterface(boolean isClass)
Set whether this is really a class, or an interface. |
void |
setConstructors(ConstructorElement[] els)
Set the constructors for this class. |
void |
setFields(FieldElement[] els)
Set the fields for this class. |
void |
setInitializers(InitializerElement[] els)
Set the initializer blocks for this class. |
void |
setInterfaces(Identifier[] ids)
Set the interfaces for this class. |
void |
setMethods(MethodElement[] els)
Set the methods for this class. |
void |
setName(Identifier name)
Set the name of this member. |
void |
setSuperclass(Identifier superClass)
Set the superclass of this class. |
static void |
unregister(ClassElement.Finder f)
Unregister a finder for locating class elements. |
Methods inherited from class org.openide.src.MemberElement |
---|
getDeclaringClass, getModifiers, getName, setModifiers |
Methods inherited from class org.openide.src.Element |
---|
addPropertyChangeListener, addVetoableChangeListener, getCookie, markCurrent, removePropertyChangeListener, removeVetoableChangeListener, toString, writeReplace |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean CLASS
isClassOrInterface()
,
Constant Field Valuespublic static final boolean INTERFACE
isClassOrInterface()
,
Constant Field Valuespublic static final Identifier ROOT_OBJECT
Object
.
Constructor Detail |
---|
public ClassElement()
public ClassElement(ClassElement.Impl impl, ClassElement clazz)
impl
- implementation of functionalityclazz
- the declaring class, or null
public ClassElement(ClassElement.Impl impl, SourceElement source)
impl
- implementation of functionalitysource
- the source file this class is contained in, or null
Method Detail |
---|
public Object clone()
clone
in class MemberElement
public SourceElement getSource()
null
if the class is not attached to any sourcepublic void setClassOrInterface(boolean isClass) throws SourceException
isClass
- one of CLASS
or INTERFACE
SourceException
- if impossiblepublic boolean isClassOrInterface()
public boolean isClass()
true
if soisClassOrInterface()
public boolean isInterface()
true
if soisClassOrInterface()
public boolean isInner()
true
if soClassElement(ClassElement.Impl, ClassElement)
public int getModifiersMask()
MemberElement
getModifiersMask
in class MemberElement
java.lang.reflect.Modifier
public final void setName(Identifier name) throws SourceException
setName
in class MemberElement
name
- the name
SourceException
- if impossiblepublic final String getSignature()
public final String getVMName()
public void setSuperclass(Identifier superClass) throws SourceException
superClass
- the superclass
SourceException
- if that is impossiblepublic Identifier getSuperclass()
null
(for interfaces, or possibly for classes with superclass Object
)public void addInitializer(InitializerElement el) throws SourceException
el
- the block to add
SourceException
- if impossiblepublic void addInitializers(InitializerElement[] els) throws SourceException
els
- the blocks to add
SourceException
- if impossiblepublic void removeInitializer(InitializerElement el) throws SourceException
el
- the block to remove
SourceException
- if impossiblepublic void removeInitializers(InitializerElement[] els) throws SourceException
els
- the blocks to remove
SourceException
- if impossiblepublic void setInitializers(InitializerElement[] els) throws SourceException
els
- the new blocks
SourceException
- if impossiblepublic InitializerElement[] getInitializers()
public void addField(FieldElement el) throws SourceException
el
- the field to add
SourceException
- if impossiblepublic void addFields(FieldElement[] els) throws SourceException
els
- the fields to add
SourceException
- if impossiblepublic void removeField(FieldElement el) throws SourceException
el
- the field to remove
SourceException
- if impossiblepublic void removeFields(FieldElement[] els) throws SourceException
els
- the fields to remove
SourceException
- if impossiblepublic void setFields(FieldElement[] els) throws SourceException
els
- the new fields
SourceException
- if impossiblepublic FieldElement[] getFields()
public FieldElement getField(Identifier name)
name
- the name of the field to look for
null
if not foundpublic void addMethod(MethodElement el) throws SourceException
el
- the method to add
SourceException
- if impossiblepublic void addMethods(MethodElement[] els) throws SourceException
els
- the methods to add
SourceException
- if impossiblepublic void removeMethod(MethodElement el) throws SourceException
el
- the method to remove
SourceException
- if impossiblepublic void removeMethods(MethodElement[] els) throws SourceException
els
- the methods to remove
SourceException
- if impossiblepublic void setMethods(MethodElement[] els) throws SourceException
els
- the new methods
SourceException
- if impossiblepublic MethodElement[] getMethods()
public MethodElement getMethod(Identifier name, Type[] arguments)
name
- the method name to look forarguments
- the argument types to look for
null
if it was not foundpublic void addConstructor(ConstructorElement el) throws SourceException
el
- the constructor to add
SourceException
- if impossiblepublic void addConstructors(ConstructorElement[] els) throws SourceException
els
- the constructors to add
SourceException
- if impossiblepublic void removeConstructor(ConstructorElement el) throws SourceException
el
- the constructor to remove
SourceException
- if impossiblepublic void removeConstructors(ConstructorElement[] els) throws SourceException
els
- the constructors to remove
SourceException
- if impossiblepublic void setConstructors(ConstructorElement[] els) throws SourceException
els
- the new constructors
SourceException
- if impossiblepublic ConstructorElement[] getConstructors()
public ConstructorElement getConstructor(Type[] arguments)
arguments
- the argument types to look for
null
if it does not existpublic void addClass(ClassElement el) throws SourceException
el
- the inner class to add
SourceException
- if impossiblepublic void addClasses(ClassElement[] els) throws SourceException
els
- the inner classes to add
SourceException
- if impossiblepublic void removeClass(ClassElement el) throws SourceException
el
- the inner class to remove
SourceException
- if impossiblepublic void removeClasses(ClassElement[] els) throws SourceException
els
- the inner classes to remove
SourceException
- if impossiblepublic void setClasses(ClassElement[] els) throws SourceException
els
- the new inner classes
SourceException
- if impossiblepublic ClassElement[] getClasses()
public ClassElement getClass(Identifier name)
name
- the name to look for
null
if it does not existpublic void addInterface(Identifier in) throws SourceException
in
- the interface to add, by name
SourceException
- if impossiblepublic void addInterfaces(Identifier[] ins) throws SourceException
ins
- the interfaces to add, by name
SourceException
- if impossiblepublic void removeInterface(Identifier in) throws SourceException
in
- the interface to remove. by name
SourceException
- if impossiblepublic void removeInterfaces(Identifier in) throws SourceException
in
- the interface to remove. by name
SourceException
- if impossiblepublic void removeInterfaces(Identifier[] ins) throws SourceException
ins
- the interfaces to remove, by name
SourceException
- if impossiblepublic void removeInterface(Identifier[] ins) throws SourceException
ins
- the interfaces to remove, by name
SourceException
- if impossiblepublic void setInterfaces(Identifier[] ids) throws SourceException
ids
- the new interfaces, by name
SourceException
- if impossiblepublic Identifier[] getInterfaces()
public JavaDoc.Class getJavaDoc()
public void print(ElementPrinter printer) throws ElementPrinterInterruptException
Element
printer
- the element printer
ElementPrinterInterruptException
- if the printer canceled the printingpublic boolean hasMainMethod()
true
if this class contains a
public static void main(String[])
method, otherwise false
public boolean isDeclaredAsJavaBean()
true
if this class could be a JavaBean,
otherwise false
public boolean isDeclaredAsApplet()
Applet
or JApplet
true
if this class could be an applet,
otherwise false
.public static void register(ClassElement.Finder f)
f
- the finder to addpublic static void unregister(ClassElement.Finder f)
f
- the finder to removepublic static ClassElement forName(String name, FileObject reference)
name
- class name separated by dots, e.g. java.lang.String
.
For inner classes is accepted delimiting by '$' or by '.'
e.g. inner class A.B in package org.netbeans.test could
be specified like: org.netbeans.A.B or org.netbeans.A$B
Both possibilities are accepted.reference
- a file that is thought to belong to the same class path structure
as the desired class, used as a reference point
null
if none existsClassElement.Finder
public static ClassElement forName(String name)
forName(String,FileObject)
instead.
name
- class name separated by dots, e.g. java.lang.String
.
For inner classes is accepted delimiting by '$' or by '.'
e.g. inner class A.B in package org.netbeans.test could
be specified like: org.netbeans.A.B or org.netbeans.A$B
Both possibilities are accepted.
null
if none existsClassElement.Finder
public static ClassElement forClass(Class clazz, FileObject reference)
clazz
- class name separated by dots, e.g. java.lang.String
reference
- a file that is thought to belong to the same class path structure
as the desired class, used as a reference point
null
if none existsClassElement.Finder
public static ClassElement forClass(Class clazz)
forClass(Class,FileObject)
instead.
clazz
- class name separated by dots, e.g. java.lang.String
null
if none existsClassElement.Finder
|
org.openide.src 1.8.31 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |