|
RECODER 0.92 | |||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectrecoder.java.JavaSourceElement
recoder.java.JavaProgramElement
recoder.java.JavaNonTerminalProgramElement
recoder.java.declaration.JavaDeclaration
recoder.java.declaration.MethodDeclaration
public class MethodDeclaration
Method declaration.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface recoder.abstraction.ProgramModelElement |
|---|
ProgramModelElement.LexicalOrder |
| Nested classes/interfaces inherited from interface recoder.abstraction.ProgramModelElement |
|---|
ProgramModelElement.LexicalOrder |
| Field Summary |
|---|
| Fields inherited from class recoder.java.JavaSourceElement |
|---|
factory |
| Fields inherited from interface recoder.abstraction.ProgramModelElement |
|---|
LEXICAL_ORDER |
| Fields inherited from interface recoder.bytecode.AccessFlags |
|---|
ABSTRACT, ANNOTATION, BRIDGE, ENUM, FINAL, INTERFACE, NATIVE, PRIVATE, PROTECTED, PUBLIC, STATIC, STRICT, SUPER, SYNCHRONIZED, SYNTHETIC, TRANSIENT, VARARGS, VOLATILE |
| Fields inherited from interface recoder.abstraction.ProgramModelElement |
|---|
LEXICAL_ORDER |
| Fields inherited from interface recoder.bytecode.AccessFlags |
|---|
ABSTRACT, ANNOTATION, BRIDGE, ENUM, FINAL, INTERFACE, NATIVE, PRIVATE, PROTECTED, PUBLIC, STATIC, STRICT, SUPER, SYNCHRONIZED, SYNTHETIC, TRANSIENT, VARARGS, VOLATILE |
| Constructor Summary | |
|---|---|
|
MethodDeclaration()
Method declaration. |
|
MethodDeclaration(ASTList<DeclarationSpecifier> modifiers,
TypeReference returnType,
Identifier name,
ASTList<ParameterDeclaration> parameters,
Throws exceptions)
Method declaration. |
|
MethodDeclaration(ASTList<DeclarationSpecifier> modifiers,
TypeReference returnType,
Identifier name,
ASTList<ParameterDeclaration> parameters,
Throws exceptions,
StatementBlock body)
Method declaration. |
protected |
MethodDeclaration(MethodDeclaration proto)
Method declaration. |
| Method Summary | |
|---|---|
void |
accept(SourceVisitor v)
Receive a visitor, for instance a pretty printer. |
void |
addTypeToScope(ClassType type,
java.lang.String name)
|
void |
addVariableToScope(VariableSpecification var)
|
MethodDeclaration |
deepClone()
Deep clone. |
NonTerminalProgramElement |
getASTParent()
Get AST parent. |
java.lang.String |
getBinaryName()
Returns the binary name. |
StatementBlock |
getBody()
Get body. |
ProgramElement |
getChildAt(int index)
Returns the child at the specified index in this node's "virtual" child array |
int |
getChildCount()
Returns the number of children of this node. |
int |
getChildPositionCode(ProgramElement child)
Returns the positional code of the given child, or -1 if
there is no such child. |
ClassTypeContainer |
getContainer()
Returns the enclosing package or class type, or method. |
ClassType |
getContainingClassType()
Returns the logical parent type of this member. |
java.util.List<ClassType> |
getExceptions()
Returns the exceptions of this method or constructor. |
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source. |
java.lang.String |
getFullName()
Returns the maximal expanded name including all applicable qualifiers. |
Identifier |
getIdentifier()
Get identifier. |
SourceElement |
getLastElement()
Finds the source element that occurs last in the source. |
TypeDeclaration |
getMemberParent()
Get member parent. |
java.lang.String |
getName()
Get name. |
Package |
getPackage()
Returns the package this element is defined in. |
ParameterDeclaration |
getParameterDeclarationAt(int index)
|
int |
getParameterDeclarationCount()
Get the number of parameters in this container. |
ASTList<ParameterDeclaration> |
getParameters()
Get parameters. |
ProgramModelInfo |
getProgramModelInfo()
Returns the instance that can retrieve information about this program model element. |
Type |
getReturnType()
Returns the return type of this method. |
java.util.List<Type> |
getSignature()
Returns the signature of this method or constructor. |
Statement |
getStatementAt(int index)
|
int |
getStatementCount()
Get the number of statements in this container. |
Throws |
getThrown()
Get thrown. |
TypeDeclaration |
getTypeDeclarationAt(int index)
|
int |
getTypeDeclarationCount()
Get the number of type declarations in this container. |
ClassType |
getTypeInScope(java.lang.String typename)
|
ASTList<TypeParameterDeclaration> |
getTypeParameters()
|
TypeReference |
getTypeReference()
Get return type. |
TypeReference |
getTypeReferenceAt(int index)
|
int |
getTypeReferenceCount()
Get the number of type references in this container. |
java.util.List<TypeDeclaration> |
getTypes()
returns the types declared in the corresponding StatementBlock, if there is any (i.e. method is not abstract). |
java.util.List<TypeDeclaration> |
getTypesInScope()
|
VariableSpecification |
getVariableInScope(java.lang.String tname)
|
java.util.List<VariableSpecification> |
getVariablesInScope()
|
boolean |
isAbstract()
Test whether the declaration is abstract. |
boolean |
isDefinedScope()
Check if the scope has been set up. |
boolean |
isFinal()
Test whether the declaration is final. |
boolean |
isNative()
Test whether the declaration is native. |
boolean |
isPrivate()
Test whether the declaration is private. |
boolean |
isProtected()
Test whether the declaration is protected. |
boolean |
isPublic()
Test whether the declaration is public. |
boolean |
isStatic()
Test whether the declaration is static. |
boolean |
isStrictFp()
Test whether the declaration is strictfp. |
boolean |
isSynchronized()
Test whether the declaration is synchronized. |
boolean |
isVarArgMethod()
Checks if this method takes a variable number of arguments. |
void |
makeParentRoleValid()
Make parent role valid. |
void |
removeTypeFromScope(java.lang.String name)
|
void |
removeVariableFromScope(java.lang.String tname)
|
boolean |
replaceChild(ProgramElement p,
ProgramElement q)
Replace a single child in the current node. |
void |
setBody(StatementBlock body)
Set body. |
void |
setDefinedScope(boolean defined)
Sets the scope to be defined or undefined. |
void |
setIdentifier(Identifier id)
Set identifier. |
void |
setMemberParent(TypeDeclaration decl)
Set member parent. |
void |
setParameters(ASTList<ParameterDeclaration> list)
Set parameters. |
void |
setProgramModelInfo(ProgramModelInfo service)
Sets the instance that can retrieve information about this program model element. |
void |
setThrown(Throws exceptions)
Set thrown. |
void |
setTypeParameters(ASTList<TypeParameterDeclaration> typeParameters)
|
void |
setTypeReference(TypeReference type)
Sets the return type. |
java.lang.String |
toString()
|
| Methods inherited from class recoder.java.declaration.JavaDeclaration |
|---|
getAnnotations, getDeclarationSpecifiers, getModifiers, getVisibilityModifier, isTransient, isVolatile, setDeclarationSpecifiers |
| Methods inherited from class recoder.java.JavaNonTerminalProgramElement |
|---|
getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAll |
| Methods inherited from class recoder.java.JavaProgramElement |
|---|
getComments, getID, setComments, validate |
| Methods inherited from class recoder.java.JavaSourceElement |
|---|
getEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface recoder.java.Declaration |
|---|
getDeclarationSpecifiers, setDeclarationSpecifiers |
| Methods inherited from interface recoder.abstraction.Member |
|---|
getAnnotations |
| Constructor Detail |
|---|
public MethodDeclaration()
public MethodDeclaration(ASTList<DeclarationSpecifier> modifiers,
TypeReference returnType,
Identifier name,
ASTList<ParameterDeclaration> parameters,
Throws exceptions)
modifiers - a modifier mutable list.returnType - a type reference.name - an identifier.parameters - a parameter declaration mutable list.exceptions - a throws.
public MethodDeclaration(ASTList<DeclarationSpecifier> modifiers,
TypeReference returnType,
Identifier name,
ASTList<ParameterDeclaration> parameters,
Throws exceptions,
StatementBlock body)
modifiers - a modifier mutable list.returnType - a type reference.name - an identifier.parameters - a parameter declaration mutable list.exceptions - a throws.body - a statement block.protected MethodDeclaration(MethodDeclaration proto)
proto - a method declaration.| Method Detail |
|---|
public MethodDeclaration deepClone()
deepClone in interface SourceElementpublic void makeParentRoleValid()
makeParentRoleValid in interface NonTerminalProgramElementmakeParentRoleValid in class JavaDeclarationpublic int getChildPositionCode(ProgramElement child)
NonTerminalProgramElement-1 if
there is no such child. The result contains an encoding of the relative
position of the child as well as the role it has been playing in this
parent element. This information is required internally for proper undo
of transformations and is to be delivered to the detached method of the
ChangeHistory.
getChildPositionCode in interface NonTerminalProgramElementchild - the exact child to look for.
-1.ChangeHistory.detached(recoder.java.ProgramElement, recoder.java.NonTerminalProgramElement, int)public SourceElement getFirstElement()
JavaSourceElement
getFirstElement in interface SourceElementgetFirstElement in class JavaSourceElementJavaSourceElement.toSource(),
JavaSourceElement.getStartPosition()public SourceElement getLastElement()
JavaSourceElement
getLastElement in interface SourceElementgetLastElement in class JavaSourceElementJavaSourceElement.toSource(),
JavaSourceElement.getEndPosition()public NonTerminalProgramElement getASTParent()
getASTParent in interface ProgramElementpublic TypeDeclaration getMemberParent()
getMemberParent in interface MemberDeclarationpublic void setMemberParent(TypeDeclaration decl)
setMemberParent in interface MemberDeclarationdecl - a type declaration.public int getChildCount()
getChildCount in interface NonTerminalProgramElementpublic ProgramElement getChildAt(int index)
getChildAt in interface NonTerminalProgramElementindex - an index into this node's "virtual" child array
java.lang.ArrayIndexOutOfBoundsException - if index is out of boundspublic int getStatementCount()
getStatementCount in interface StatementContainerpublic Statement getStatementAt(int index)
getStatementAt in interface StatementContainer
public boolean replaceChild(ProgramElement p,
ProgramElement q)
replaceChild in interface NonTerminalProgramElementp - the old child.p - the new child.
java.lang.ClassCastException - if the new child cannot take over the role of the old one.public int getTypeReferenceCount()
getTypeReferenceCount in interface TypeReferenceContainerpublic TypeReference getTypeReferenceAt(int index)
getTypeReferenceAt in interface TypeReferenceContainerpublic int getParameterDeclarationCount()
getParameterDeclarationCount in interface ParameterContainerpublic ParameterDeclaration getParameterDeclarationAt(int index)
getParameterDeclarationAt in interface ParameterContainerpublic TypeReference getTypeReference()
public void setTypeReference(TypeReference type)
public final java.lang.String getName()
getName in interface NamedModelElementpublic Identifier getIdentifier()
getIdentifier in interface NamedProgramElementpublic void setIdentifier(Identifier id)
setIdentifier in interface NamedProgramElementid - an identifier.public ASTList<ParameterDeclaration> getParameters()
public void setParameters(ASTList<ParameterDeclaration> list)
list - a parameter declaration mutable list.public Throws getThrown()
public void setThrown(Throws exceptions)
exceptions - a throws.public StatementBlock getBody()
public void setBody(StatementBlock body)
body - a statement block.public boolean isFinal()
isFinal in interface MemberisFinal in class JavaDeclarationtrue if this member is final, false
otherwise.public boolean isPrivate()
isPrivate in interface MemberisPrivate in interface MemberDeclarationisPrivate in class JavaDeclarationtrue if this member is private, false
otherwise.public boolean isProtected()
isProtected in interface MemberisProtected in interface MemberDeclarationisProtected in class JavaDeclarationtrue if this member is protected, false
otherwise.public boolean isPublic()
isPublic in interface MemberisPublic in interface MemberDeclarationisPublic in class JavaDeclarationtrue if this member is public, false
otherwise.public boolean isStatic()
isStatic in interface MemberisStatic in interface MemberDeclarationisStatic in class JavaDeclarationtrue if this member is static, false
otherwise.public boolean isStrictFp()
isStrictFp in interface MemberisStrictFp in interface MemberDeclarationisStrictFp in class JavaDeclarationtrue if this member is strictfp, false
otherwise.public boolean isAbstract()
isAbstract in interface MethodisAbstract in class JavaDeclarationtrue if this member is abstract, false
otherwise.Constructorpublic boolean isNative()
isNative in interface MethodisNative in class JavaDeclarationtrue if this method is native, false
otherwise.Constructorpublic boolean isSynchronized()
isSynchronized in interface MethodisSynchronized in class JavaDeclarationtrue if this method is synchronized, false
otherwise.Constructorpublic ProgramModelInfo getProgramModelInfo()
ProgramModelElement
getProgramModelInfo in interface ProgramModelElementpublic void setProgramModelInfo(ProgramModelInfo service)
ProgramModelElement
setProgramModelInfo in interface ProgramModelElementservice - the program model info to be used for this element.public ClassType getContainingClassType()
Member
getContainingClassType in interface Memberpublic Type getReturnType()
Method
getReturnType in interface Methodpublic java.util.List<Type> getSignature()
Method
getSignature in interface Methodpublic java.util.List<ClassType> getExceptions()
Method
getExceptions in interface Methodpublic ClassTypeContainer getContainer()
ClassTypeContainer
getContainer in interface ClassTypeContainerpublic Package getPackage()
ClassTypeContainer
getPackage in interface ClassTypeContainerpublic java.util.List<TypeDeclaration> getTypes()
RecoderList.EMPTY_LIST otherwise.
WARNING: Former (incorrect) implementations of this method returned the
member types of the declaring class instead.
getTypes in interface ClassTypeContainerpublic java.lang.String getFullName()
ProgramModelElement
getFullName in interface ProgramModelElementpublic java.lang.String getBinaryName()
ProgramModelElement
getBinaryName in interface ProgramModelElementpublic boolean isDefinedScope()
ScopeDefiningElement
isDefinedScope in interface ScopeDefiningElementpublic void setDefinedScope(boolean defined)
ScopeDefiningElement
setDefinedScope in interface ScopeDefiningElementpublic java.util.List<VariableSpecification> getVariablesInScope()
getVariablesInScope in interface VariableScopepublic VariableSpecification getVariableInScope(java.lang.String tname)
getVariableInScope in interface VariableScopepublic void addVariableToScope(VariableSpecification var)
addVariableToScope in interface VariableScopepublic void removeVariableFromScope(java.lang.String tname)
removeVariableFromScope in interface VariableScopepublic void accept(SourceVisitor v)
SourceElement
accept in interface SourceElementv - a source visitor.public boolean isVarArgMethod()
Method
isVarArgMethod in interface Methodtrue if this methods takes a variable number of arguments,
false otherwise.public ASTList<TypeParameterDeclaration> getTypeParameters()
getTypeParameters in interface Methodpublic void setTypeParameters(ASTList<TypeParameterDeclaration> typeParameters)
public int getTypeDeclarationCount()
TypeDeclarationContainer
getTypeDeclarationCount in interface TypeDeclarationContainerpublic TypeDeclaration getTypeDeclarationAt(int index)
getTypeDeclarationAt in interface TypeDeclarationContainerpublic java.util.List<TypeDeclaration> getTypesInScope()
getTypesInScope in interface TypeScopepublic ClassType getTypeInScope(java.lang.String typename)
getTypeInScope in interface TypeScope
public void addTypeToScope(ClassType type,
java.lang.String name)
addTypeToScope in interface TypeScopepublic void removeTypeFromScope(java.lang.String name)
removeTypeFromScope in interface TypeScopepublic java.lang.String toString()
toString in class java.lang.Object
|
RECODER 0.92 | |||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||