Module org.glavo.classfile
Package org.glavo.classfile.impl
Record Class TransformImpl.MethodCodeTransform
java.lang.Object
java.lang.Record
org.glavo.classfile.impl.TransformImpl.MethodCodeTransform
- All Implemented Interfaces:
ClassFileTransform<MethodTransform,,MethodElement, MethodBuilder> MethodTransform
- Enclosing class:
TransformImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.glavo.classfile.ClassFileTransform
ClassFileTransform.ResolvedTransform<E extends ClassFileElement> -
Field Summary
Fields inherited from interface org.glavo.classfile.MethodTransform
ACCEPT_ALL -
Constructor Summary
ConstructorsConstructorDescriptionMethodCodeTransform(CodeTransform xform) Creates an instance of aMethodCodeTransformrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaccept(MethodBuilder builder, MethodElement element) Transform an element by taking the appropriate actions on the builder.andThen(MethodTransform next) Chain this transform with another; elements presented to the builder of this transform will become the input to the next transform.default voidatEnd(MethodBuilder builder) Take any final action during transformation of a classfile entity.default voidatStart(MethodBuilder builder) Take any preliminary action during transformation of a classfile entity.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.resolve(MethodBuilder builder) Bind a transform to a builder.final StringtoString()Returns a string representation of this record class.xform()Returns the value of thexformrecord component.
-
Constructor Details
-
MethodCodeTransform
Creates an instance of aMethodCodeTransformrecord class.- Parameters:
xform- the value for thexformrecord component
-
-
Method Details
-
resolve
Description copied from interface:ClassFileTransformBind a transform to a builder. If the transform is chained, intermediate builders are created for each chain link. If the transform is stateful (see, e.g.,ClassTransform.ofStateful(Supplier)), the supplier is invoked to get a fresh transform object.This method is a low-level method that should rarely be used by user code; most of the time, user code should prefer
ClassFileBuilder.transform(CompoundElement, ClassFileTransform), which resolves the transform and executes it on the current builder.- Specified by:
resolvein interfaceClassFileTransform<MethodTransform,MethodElement, MethodBuilder> - Specified by:
resolvein interfaceMethodTransform- Parameters:
builder- the builder to bind to- Returns:
- the bound result
-
andThen
Description copied from interface:ClassFileTransformChain this transform with another; elements presented to the builder of this transform will become the input to the next transform.- Specified by:
andThenin interfaceClassFileTransform<MethodTransform,MethodElement, MethodBuilder> - Specified by:
andThenin interfaceMethodTransform- Parameters:
next- the downstream transform- Returns:
- the chained transform
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
xform
Returns the value of thexformrecord component.- Returns:
- the value of the
xformrecord component
-
accept
Description copied from interface:ClassFileTransformTransform an element by taking the appropriate actions on the builder. Used when transforming a classfile entity (class, method, field, method body.) If no transformation is desired, the element can be presented toClassFileBuilder.with(ClassFileElement). If the element is to be dropped, no action is required.- Specified by:
acceptin interfaceClassFileTransform<MethodTransform,MethodElement, MethodBuilder> - Parameters:
builder- the builder for the new entityelement- the element
-
atEnd
Description copied from interface:ClassFileTransformTake any final action during transformation of a classfile entity. Called after all elements of the class are presented toClassFileTransform.accept(ClassFileBuilder, ClassFileElement).- Specified by:
atEndin interfaceClassFileTransform<MethodTransform,MethodElement, MethodBuilder> - Parameters:
builder- the builder for the new entity
-
atStart
Description copied from interface:ClassFileTransformTake any preliminary action during transformation of a classfile entity. Called before any elements of the class are presented toClassFileTransform.accept(ClassFileBuilder, ClassFileElement).- Specified by:
atStartin interfaceClassFileTransform<MethodTransform,MethodElement, MethodBuilder> - Parameters:
builder- the builder for the new entity
-