|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openide.src.Element | +--org.openide.src.MemberElement | +--org.openide.src.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.
Inner Class Summary | |
static interface |
ClassElement.Finder
Provides a "finder" for class elements. |
static interface |
ClassElement.Impl
Pluggable behavior for class elements. |
Inner classes inherited from class org.openide.src.MemberElement |
MemberElement.Impl |
Inner classes inherited from class org.openide.src.Element |
Element.Impl, 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)
Search for a class element throughout the system. |
static ClassElement |
forName(String name)
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()
public static final boolean INTERFACE
isClassOrInterface()
public 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()
CLASS
or INTERFACE
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
org.openide.src.MemberElement
Modifier
public final void setName(Identifier name) throws SourceException
setName
in class MemberElement
name
- the nameSourceException
- if impossiblepublic final String getSignature()
public final String getVMName()
public void setSuperclass(Identifier superClass) throws SourceException
superClass
- the superclassSourceException
- 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 addSourceException
- if impossiblepublic void addInitializers(InitializerElement[] els) throws SourceException
els
- the blocks to addSourceException
- if impossiblepublic void removeInitializer(InitializerElement el) throws SourceException
el
- the block to removeSourceException
- if impossiblepublic void removeInitializers(InitializerElement[] els) throws SourceException
els
- the blocks to removeSourceException
- if impossiblepublic void setInitializers(InitializerElement[] els) throws SourceException
els
- the new blocksSourceException
- if impossiblepublic InitializerElement[] getInitializers()
public void addField(FieldElement el) throws SourceException
el
- the field to addSourceException
- if impossiblepublic void addFields(FieldElement[] els) throws SourceException
els
- the fields to addSourceException
- if impossiblepublic void removeField(FieldElement el) throws SourceException
el
- the field to removeSourceException
- if impossiblepublic void removeFields(FieldElement[] els) throws SourceException
els
- the fields to removeSourceException
- if impossiblepublic void setFields(FieldElement[] els) throws SourceException
els
- the new fieldsSourceException
- if impossiblepublic FieldElement[] getFields()
public FieldElement getField(Identifier name)
name
- the name of the field to look fornull
if not foundpublic void addMethod(MethodElement el) throws SourceException
el
- the method to addSourceException
- if impossiblepublic void addMethods(MethodElement[] els) throws SourceException
els
- the methods to addSourceException
- if impossiblepublic void removeMethod(MethodElement el) throws SourceException
el
- the method to removeSourceException
- if impossiblepublic void removeMethods(MethodElement[] els) throws SourceException
els
- the methods to removeSourceException
- if impossiblepublic void setMethods(MethodElement[] els) throws SourceException
els
- the new methodsSourceException
- if impossiblepublic MethodElement[] getMethods()
public MethodElement getMethod(Identifier name, Type[] arguments)
name
- the method name to look forarguments
- the argument types to look fornull
if it was not foundpublic void addConstructor(ConstructorElement el) throws SourceException
el
- the constructor to addSourceException
- if impossiblepublic void addConstructors(ConstructorElement[] els) throws SourceException
els
- the constructors to addSourceException
- if impossiblepublic void removeConstructor(ConstructorElement el) throws SourceException
el
- the constructor to removeSourceException
- if impossiblepublic void removeConstructors(ConstructorElement[] els) throws SourceException
els
- the constructors to removeSourceException
- if impossiblepublic void setConstructors(ConstructorElement[] els) throws SourceException
els
- the new constructorsSourceException
- if impossiblepublic ConstructorElement[] getConstructors()
public ConstructorElement getConstructor(Type[] arguments)
arguments
- the argument types to look fornull
if it does not existpublic void addClass(ClassElement el) throws SourceException
el
- the inner class to addSourceException
- if impossiblepublic void addClasses(ClassElement[] els) throws SourceException
el
- the inner classes to addSourceException
- if impossiblepublic void removeClass(ClassElement el) throws SourceException
el
- the inner class to removeSourceException
- if impossiblepublic void removeClasses(ClassElement[] els) throws SourceException
els
- the inner classes to removeSourceException
- if impossiblepublic void setClasses(ClassElement[] els) throws SourceException
els
- the new inner classesSourceException
- if impossiblepublic ClassElement[] getClasses()
public ClassElement getClass(Identifier name)
name
- the name to look fornull
if it does not existpublic void addInterface(Identifier in) throws SourceException
in
- the interface to add, by nameSourceException
- if impossiblepublic void addInterfaces(Identifier[] ins) throws SourceException
ins
- the interfaces to add, by nameSourceException
- if impossiblepublic void removeInterface(Identifier in) throws SourceException
in
- the interface to remove. by nameSourceException
- if impossiblepublic void removeInterfaces(Identifier in) throws SourceException
in
- the interface to remove. by nameSourceException
- if impossiblepublic void removeInterfaces(Identifier[] ins) throws SourceException
ins
- the interfaces to remove, by nameSourceException
- if impossiblepublic void removeInterface(Identifier[] ins) throws SourceException
ins
- the interfaces to remove, by nameSourceException
- if impossiblepublic void setInterfaces(Identifier[] ids) throws SourceException
ids
- the new interfaces, by nameSourceException
- if impossiblepublic Identifier[] getInterfaces()
public JavaDoc.Class getJavaDoc()
public void print(ElementPrinter printer) throws ElementPrinterInterruptException
Element
print
in class Element
org.openide.src.Element
printer
- the element printerElementPrinterInterruptException
- 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 javax.swing.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)
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)
name
- class name separated by dots, e.g. java.lang.String
null
if none existsClassElement.Finder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |