Interface IJavaMethod
- All Superinterfaces:
IJavaDecompilableElement
,IJavaElement
Java AST interface to represent a Java method.
-
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
FLAG_BUILT, FLAG_FIELD_REFERENCES_OUTERCLASS, FLAG_LAMBDA_CLASS, FLAG_LAMBDA_IMPL, FLAG_OPTIONAL_RENDERING, FLAG_SECOND_PARAMETER_IS_OUTER_REF, FLAG_STICKY
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Delete a statement by reference.Duplicate this element.void
fromFlatList
(List<IJavaStatement> list) void
generate
(JavaOutputSink out, boolean bodyOnly) void
generate
(JavaOutputSink out, int genkind) int
getBody()
Get the body of the method.Get the type of the entity containing this method.Get the default value provided by this method if there is one.int
getName()
Get the original method name.getParameter
(int index) getParameterAnnotations
(int index) int
Get the parameters of the method.Get the return type of the method.Get the original method signature.Walk the tree and get the ordered list of all (non-pseudo) statements that make up the method.int
boolean
boolean
boolean
boolean
boolean
isEmpty()
boolean
isInner()
boolean
isNative()
boolean
boolean
boolean
isPublic()
boolean
boolean
isStatic()
Determine whether this method is a static method.boolean
void
void
setDefaultValue
(IJavaExpression defaultValue) void
setIndexOfFirstVisibleParameter
(int index) Methods inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaDecompilableElement
getGlobalContext, isBuilt, isExternal, isOptionalRendering, markBuilt, markOptionalRendering
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
addFlags, addTag, canCauseException, collectAllPhysicalOffsets, generate, getData, getElementType, getFlags, getOrigin, getPhysicalMethodIndex, getPhysicalOffset, getReconAnon, getReconEnum, getReconEnummap, getReconLambda, getSubElements, getTags, hasFlags, hasPhysicalMethodIndex, hasPhysicalOffset, isReconArtifact, removeFlags, removeTag, replaceSubElement, setData, setFlags, setLambdaRecon, setOrigin, setPhysicalMethodIndex, setPhysicalOffset, setReconAnon, setReconEnum, setReconEnummap, toShortString, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPre, visitDepthPre, visitDepthPre
-
Method Details
-
getLabelFactory
IJavaLabelFactory getLabelFactory()- Returns:
-
getIdentifierManager
IJavaIdentifierManager getIdentifierManager()- Returns:
-
getName
String getName()Get the original method name. The returned name is a simple name, without parameter, return, or type information.- Specified by:
getName
in interfaceIJavaDecompilableElement
- Returns:
- the method name
-
getSignature
String getSignature()Get the original method signature.- Specified by:
getSignature
in interfaceIJavaDecompilableElement
- Returns:
- the method signature
-
getParameter
- Parameters:
index
-- Returns:
-
getParameterCount
int getParameterCount()- Returns:
-
setIndexOfFirstVisibleParameter
void setIndexOfFirstVisibleParameter(int index) -
getIndexOfFirstVisibleParameter
int getIndexOfFirstVisibleParameter()- Returns:
-
getVisibleParameterCount
int getVisibleParameterCount()- Returns:
-
getVisibleParameters
List<IJavaDefinition> getVisibleParameters() -
getParameters
List<IJavaDefinition> getParameters()Get the parameters of the method.Note: If the method is non-static, the first parameter in the list would be `this`.
- Returns:
- the list of parameters
-
markSecondParameterOuterClassReference
void markSecondParameterOuterClassReference() -
isSecondParameterOuterClassReference
boolean isSecondParameterOuterClassReference() -
getReturnType
IJavaType getReturnType()Get the return type of the method.- Returns:
- the return type
-
getBody
IJavaBlock getBody()Get the body of the method.- Returns:
- the body, null if none
-
isEmpty
boolean isEmpty()- Returns:
-
isConstructor
boolean isConstructor() -
isClassConstructor
boolean isClassConstructor() -
isClassInitializer
boolean isClassInitializer() -
getAccessFlags
int getAccessFlags() -
isStatic
boolean isStatic()Determine whether this method is a static method.- Returns:
- true if the method is static, false otherwise (virtual method)
-
isSynthetic
boolean isSynthetic() -
isAbstract
boolean isAbstract() -
isNative
boolean isNative() -
isPublic
boolean isPublic() -
isProtected
boolean isProtected() -
isPrivate
boolean isPrivate() -
isInner
boolean isInner() -
getClassType
IJavaType getClassType()Get the type of the entity containing this method.- Returns:
-
getInnerClassSignatures
- Returns:
-
getInnerClasses
List<IJavaClass> getInnerClasses()- Returns:
-
getAnonymousClassSignatures
- Returns:
-
getAnonymousClasses
List<IJavaClass> getAnonymousClasses()- Returns:
-
getMethodAnnotations
List<IJavaAnnotation> getMethodAnnotations()- Returns:
-
getParameterAnnotations
- Returns:
-
setDefaultValue
-
getDefaultValue
IJavaExpression getDefaultValue()Get the default value provided by this method if there is one.- Returns:
- a default value or null
-
getStatements
List<IJavaStatement> getStatements()Walk the tree and get the ordered list of all (non-pseudo) statements that make up the method.- Returns:
-
deleteStatement
Delete a statement by reference. This method performs a deep search within the entire method. This works because no method should contain the same statement (in the sense, same reference) twice.- Parameters:
stm
- the statement to delete- Returns:
- true if the statement was found and deleted
-
generate
-
generate
- Parameters:
out
-genkind
- 0= regular method; 1= just the body of the method; 2= the method is a lambda
-
toFlatList
List<IJavaStatement> toFlatList()- Returns:
-
fromFlatList
- Parameters:
list
-
-
duplicate
IJavaMethod duplicate()Description copied from interface:IJavaElement
Duplicate this element.- Specified by:
duplicate
in interfaceIJavaDecompilableElement
- Specified by:
duplicate
in interfaceIJavaElement
- Returns:
- a (possibly) duplicated object of the same type
-