JavaClass Class
- public class JavaClass
extends JavaMember
JavaClass is a DefaultSourceElement derivation that represents a top-level or
inner java class.
JavaClass objects may have children of many types, including any derivation of
JavaMember
, such as JavaClass
,
JavaMember
, and JavaMethod
. A
javadoc comment preceding a java class declaration will appear as a child of the
class of type JavaComment
.
The properties available on an object of this type may be found by looking at the
getDefaultPropertyDescriptors
method.
All java parse tree objects are instantiated as part of parse tree
construction by the JavaBuilder
class.
-
Hierarchy
-
Object
DefaultElement
DefaultTreeElement
DefaultDocumentElement
DefaultSourceElement
JavaElement
JavaModifierSupport
JavaMember
JavaClass
-
All Implemented Interfaces
-
IDocumentElement
, IElement
, ISourceElement
, IStructureFeature.IStructureNode
, ITreeElement
-
Direct Known Subclasses
-
ControlClass
public static final String |
-
PROP_INTERTYPES
- Property key for the super-interfaces property of JavaClass objects.
|
public static final String |
-
PROP_ISINTERFACE
- Property key for the is-interface property of JavaClass objects.
|
public static final String |
-
PROP_SUPERTYPE
- Property key for the super-type property of JavaClass objects.
|
-
JavaClass()
- Creates a new object containing a null cookie.
|
-
JavaClass(
Object compilerCookie)
- Creates a new object containing the specified cookie.
|
Methods from com.bea.ide.lang.java.element.JavaModifierSupport |
getAbstract , getDefaultPropertyDescriptors , getFinal , getNative , getStatic , getStrictFloatingPoint , getSynchronized , getTransient , getVolatile , mergePropertyDescriptors , setAbstract , setFinal , setNative , setStatic , setStrictFloatingPoint , setSynchronized , setTransient , setVolatile
|
Methods from com.bea.ide.sourceeditor.element.DefaultSourceElement |
addChild , createAuthorNode , debugDump , equals , getChildrenByClass , getClassLoader , getCookie , getDefaultPropertyDescriptors , getDiagnostics , getGroup , getInstanceName , getPropertyCode , getPropertyDescriptors , getPropertySourceRange , getPropertySourceRanges , getPropertySourceText , getPropertySourceText , getRange , getRange , getStatus , initializeRange , initializeRange , insertChild , markRemovedFromTree , mergeElements , mergeFrom , propertyModified , removeChild , removeChild , replaceChild , requestAddChild , requestAddChild , requestRemoveChild , requestSetProperty , setProperty , setStatus
|
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods from interface com.bea.ide.sourceeditor.element.ISourceElement |
createAuthorNode , getCookie , getDiagnostics , getPropertyCode , getRange , getStatus , mergeFrom , requestAddChild , requestAddChild , requestRemoveChild , requestSetProperty
|
PROP_INTERTYPES
public static final String
PROP_INTERTYPES
- Property key for the super-interfaces property of JavaClass objects.
PROP_ISINTERFACE
public static final String
PROP_ISINTERFACE
- Property key for the is-interface property of JavaClass objects.
PROP_SUPERTYPE
public static final String
PROP_SUPERTYPE
- Property key for the super-type property of JavaClass objects.
JavaClass
public JavaClass()
- Creates a new object containing a null cookie. This constructor should be used by callers constructing objects
that are not part of an active parse tree, such as those to be added via two-way edit.
JavaClass
public JavaClass(Object
compilerCookie)
- Creates a new object containing the specified cookie. This constructor should only be called by
ILanguageBuilder
implementations.
getClass(String) Method
public JavaClass
getClass(String
name)
Shortcut method for finding an inner class with a particular name.
Parameters
-
name
- the name of the desired class
Returns
- an inner class with matching name, if found. May return
null if no such class exists.
getDefaultPropertyDescriptors() Method
public DefaultSourceElement.CompilerPropertyDescriptor
[] getDefaultPropertyDescriptors()
Objects of this type define the following properties:
JavaClass.PROP_INTERTYPES
: the interfaces implemented by this class.
JavaClass.PROP_SUPERTYPE
: the super type of this class.
JavaClass.PROP_ISINTERFACE
: whether or not this class is itself an interface.
Additionally, all DefaultSourceElement derivations also inherit all properties
returned by getDefaultPropertyDescriptors
from all super classes.
-
Overrides
-
JavaMember.getDefaultPropertyDescriptors()
getIsInterface() Method
public boolean getIsInterface()
Returns whether this class is an interface.
getMethod(String, JavaArgument[]) Method
public JavaMethod
getMethod(String
name,
JavaArgument
[] args)
Shortcut method for finding a method with a particular signature
within this java class.
Parameters
-
name
- the name of the desired method
-
args
- the JavaArgument objects of the desired method
Returns
- a java method with matching signature, if found. May return
null if no such method exists.
getMethod(String, String[]) Method
public JavaMethod
getMethod(String
name,
String
[] args)
Shortcut method for finding a method with a particular signature
within this java class.
Parameters
-
name
- the name of the desired method
-
args
- the types of the arguments of the desired method
Returns
- a java method with matching signature, if found. May return
null if no such method exists.
getProperty(String) Method
public Object
getProperty(String
sProp)
isAuthorProperty is overridden to ensure that we return a non-null name for anonymous inner classes.
-
Overrides
-
DefaultSourceElement.getProperty(String)
Parameters
-
sProp
- The desired property's name. This property must be part of this element's property descriptors.
Returns
- The property's value.
getRangePrefetchProperties() Method
protected Set
getRangePrefetchProperties()
Anonymous JavaClass objects remove their 'name' property from the prefetch set.
-
Overrides
-
DefaultSourceElement.getRangePrefetchProperties()
getSuperInterfaces() Method
public String
[] getSuperInterfaces()
Returns all interfaces implemented by this class.
getSuperType() Method
public String
getSuperType()
Gets the SuperClass of this JavaClass
Returns
- SuperClass
getTypeCode() Method
public IStructureFeature.StructureCode
getTypeCode()
This method returns a code used by the compiler to identify the type of this element.
This method should not be called directly, since the return value isn't useful outside
of the compiler.
-
Overrides
-
DefaultSourceElement.getTypeCode()
Returns
- A compiler structure code identifying the type of this element.
getVariable(String) Method
public JavaVariable
getVariable(String
name)
Shortcut method for finding a member variable with a particular name.
Parameters
-
name
- the name of the desired member variable.
Returns
- a member variable with matching name, if found. May return
null if no such member variable exists.
isAuthorProperty(DefaultSourceElement.CompilerPropertyDescriptor) Method
protected boolean isAuthorProperty(DefaultSourceElement.CompilerPropertyDescriptor
pd)
isAuthorProperty is overridden to ensure that we do not submit names for anonymous inner classes
during two-way edits.
-
Overrides
-
DefaultSourceElement.isAuthorProperty(DefaultSourceElement.CompilerPropertyDescriptor)
Parameters
-
pd
- The property descriptor that could be passed to the compiler
Returns
- boolean indicating whether the specified property should be passed.
setIsInterface(boolean) Method
public void setIsInterface(boolean newboolean)
Sets whether this class is an interface.
setSuperInterfaces(String[]) Method
public void setSuperInterfaces(String
[] superInterfaces)
Sets the interface set implemented by this class.
setSuperType(String) Method
public void setSuperType(String
newString)
Sets the SuperClass of this JavaClass
toString() Method
public String
toString()
Stringify by returning my name
-
Overrides
-
JavaMember.toString()
visit(JavaVisitor, Object) Method
public Object
visit(JavaVisitor
v,
Object
arg)
Provides JavaVisitor
support for this element type.
-
Overrides
-
JavaElement.visit(JavaVisitor, Object)
Parameters
-
v
- The visitor
-
arg
- An argument to the visit, to be interpreted by the visitor.
Returns
- Object returned by the visitor.