Class Method
java.lang.Object
org.matwoess.jsourceprofiler.tool.model.Method
- All Implemented Interfaces:
Serializable,Component
Model class representing a java method.
Stores the containing class, the method name and the block representing the method body.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns a list of all blocks in this method, including inner blocks recursively.Returns the block representing the method body.inthashCode()booleanWhether this method is abstract.voidsetMethodBlock(Block block) Sets the given block as the method body.voidsetParentClass(JClass parentClass) Stores the given class as the parent class of this method.toString()
-
Field Details
-
name
-
parentClass
-
methodBlock
-
-
Constructor Details
-
Method
Creates a new Method with the given name.- Parameters:
name- the name of the method
-
-
Method Details
-
setParentClass
Stores the given class as the parent class of this method.Additionally, this method is added to the list of methods for the parent class.
- Parameters:
parentClass- the parent class
-
setMethodBlock
Sets the given block as the method body.- Parameters:
block- the method body block
-
getMethodBlock
Returns the block representing the method body.- Returns:
- the method body block
-
getBlocksRecursive
Returns a list of all blocks in this method, including inner blocks recursively.If this method is abstract, an empty list is returned.
- Returns:
- the list of all blocks in this method
-
isAbstract
public boolean isAbstract()Whether this method is abstract.- Returns:
- true if this method has no body-block
-
toString
-
equals
-
hashCode
public int hashCode()
-