Class XmlMethod
- java.lang.Object
-
- org.eolang.jeo.representation.xmir.XmlMethod
-
public final class XmlMethod extends Object
XML method.- Since:
- 0.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlMethod.Without
Predicated for filtering commands.
-
Constructor Summary
Constructors Constructor Description XmlMethod(String name, int access, String descriptor, XmlBytecodeEntry... entries)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
access()
Method access modifiers.XmlMethod
copy()
Copy method node.String
descriptor()
Method descriptor.void
inline(XmlMethod inline)
Inline all method invocations.List<XmlBytecodeEntry>
instructions(Predicate<XmlBytecodeEntry>... predicates)
All method instructions.List<XmlInvokeVirtual>
invokeVirtuals()
Retrieves the list of all invocations of other object methods.boolean
isConstructor()
Checks if method is a constructor.String
name()
Method name.Node
node()
XML node.void
setInstructions(List<XmlBytecodeEntry> updated)
Set instructions for method.String
toString()
-
-
-
Constructor Detail
-
XmlMethod
public XmlMethod(String name, int access, String descriptor, XmlBytecodeEntry... entries)
Constructor.- Parameters:
name
- Method name.access
- Access modifiers.descriptor
- Method descriptor.entries
- Method instructions.
-
-
Method Detail
-
name
public String name()
Method name.- Returns:
- Name.
-
access
public int access()
Method access modifiers.- Returns:
- Access modifiers.
-
descriptor
public String descriptor()
Method descriptor.- Returns:
- Descriptor.
-
node
public Node node()
XML node.- Returns:
- XML node.
-
isConstructor
public boolean isConstructor()
Checks if method is a constructor.- Returns:
- True if method is a constructor.
-
instructions
@SafeVarargs public final List<XmlBytecodeEntry> instructions(Predicate<XmlBytecodeEntry>... predicates)
All method instructions.- Parameters:
predicates
- Predicates to filter instructions.- Returns:
- Instructions.
-
copy
public XmlMethod copy()
Copy method node.- Returns:
- Instructions.
-
invokeVirtuals
public List<XmlInvokeVirtual> invokeVirtuals()
Retrieves the list of all invocations of other object methods. Usually they are invoke virtual instructions which look like this: - GET FIELD: foo - LIST OF ARGUMENTS - INVOKEVIRTUAL: bar This list represents the following command: foo.bar(a, b);- Returns:
- List of invocations.
-
inline
public void inline(XmlMethod inline)
Inline all method invocations.- Parameters:
inline
- Method to inline.
-
setInstructions
public void setInstructions(List<XmlBytecodeEntry> updated)
Set instructions for method.- Parameters:
updated
- New instructions.
-
-