Class BytecodeClass
java.lang.Object
org.eolang.jeo.representation.bytecode.BytecodeClass
Class useful for generating bytecode for testing purposes.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.BytecodeClass
(String name) Constructor.BytecodeClass
(String name, int access) Constructor.BytecodeClass
(String name, List<BytecodeMethod> methods, List<BytecodeField> fields, BytecodeAnnotations annotations, List<BytecodeAttribute> attributes, BytecodeClassProperties props) Constructor.BytecodeClass
(String name, List<BytecodeMethod> methods, BytecodeClassProperties properties) Constructor.BytecodeClass
(String name, BytecodeClassProperties properties) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionConvert to directives with opcodes' counting.directives
(boolean counting) Convert to directives.Hello world bytecode.methods()
Retrieve class methods.name()
Class name.Properties.withConstructor
(int... modifiers) Add constructor.withConstructor
(String descriptor, int... modifiers) Add constructor.Add field.withMethod
(String mname, String descriptor, int... modifiers) Add method.withMethod
(BytecodeMethodProperties properties) Add method.withMethod
(BytecodeMethodProperties properties, BytecodeMaxs maxs) Add method.Without methods.
-
Constructor Details
-
BytecodeClass
public BytecodeClass()Constructor. Used in tests only. -
BytecodeClass
Constructor. Used in tests only.- Parameters:
name
- Class name.
-
BytecodeClass
Constructor. Used in tests only.- Parameters:
name
- Class name.access
- Access modifiers.
-
BytecodeClass
Constructor. Has real usages.- Parameters:
name
- Class name.properties
- Class properties.
-
BytecodeClass
Constructor.- Parameters:
name
- Class name.methods
- Methods.properties
- Class properties.
-
BytecodeClass
public BytecodeClass(String name, List<BytecodeMethod> methods, List<BytecodeField> fields, BytecodeAnnotations annotations, List<BytecodeAttribute> attributes, BytecodeClassProperties props) Constructor.- Parameters:
name
- Class name.methods
- Methods.fields
- Fields.annotations
- Annotations.attributes
- Attributes.props
- Class properties.
-
-
Method Details
-
name
Class name.- Returns:
- Name.
-
withConstructor
Add constructor.- Parameters:
modifiers
- Constructor modifiers.- Returns:
- This object.
-
withMethod
Add method.- Parameters:
properties
- Method properties.- Returns:
- This object.
-
withMethod
Add method.- Parameters:
properties
- Method properties.maxs
- Method maxs.- Returns:
- This object.
-
withConstructor
Add constructor.- Parameters:
descriptor
- Constructor descriptor.modifiers
- Constructor modifiers.- Returns:
- This object.
-
withField
Add field.- Parameters:
fname
- Field name.- Returns:
- This object.
-
withMethod
Add method.- Parameters:
mname
- Method name.descriptor
- Method descriptor.modifiers
- Access modifiers.- Returns:
- This object.
-
helloWorldMethod
Hello world bytecode.- Returns:
- The same class with the hello world method.
-
properties
Properties.- Returns:
- Class properties.
-
methods
Retrieve class methods.- Returns:
- Class methods.
-
withoutMethods
Without methods.- Returns:
- The same class without methods.
-
directives
Convert to directives with opcodes' counting.- Returns:
- Directives.
-
directives
Convert to directives.- Parameters:
counting
- Whether to count opcodes.- Returns:
- Directives.
-