Module org.glavo.classfile
Package org.glavo.classfile.impl
Record Class TransformImpl.ClassFieldTransform
java.lang.Object
java.lang.Record
org.glavo.classfile.impl.TransformImpl.ClassFieldTransform
- All Implemented Interfaces:
ClassfileTransform<ClassTransform,,ClassElement, ClassBuilder> ClassTransform
- Enclosing class:
TransformImpl
public static record TransformImpl.ClassFieldTransform(FieldTransform transform, Predicate<FieldModel> filter)
extends Record
-
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.ClassTransform
ACCEPT_ALL -
Constructor Summary
ConstructorsConstructorDescriptionClassFieldTransform(FieldTransform transform, Predicate<FieldModel> filter) Creates an instance of aClassFieldTransformrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaccept(ClassBuilder builder, ClassElement element) Transform an element by taking the appropriate actions on the builder.andThen(ClassTransform next) Chain this transform with another; elements presented to the builder of this transform will become the input to the next transform.default voidatEnd(ClassBuilder builder) Take any final action during transformation of a classfile entity.default voidatStart(ClassBuilder builder) Take any preliminary action during transformation of a classfile entity.final booleanIndicates whether some other object is "equal to" this one.filter()Returns the value of thefilterrecord component.final inthashCode()Returns a hash code value for this object.resolve(ClassBuilder builder) Bind a transform to a builder.final StringtoString()Returns a string representation of this record class.Returns the value of thetransformrecord component.
-
Constructor Details
-
ClassFieldTransform
Creates an instance of aClassFieldTransformrecord class.- Parameters:
transform- the value for thetransformrecord componentfilter- the value for thefilterrecord 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<ClassTransform,ClassElement, ClassBuilder> - Specified by:
resolvein interfaceClassTransform- 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<ClassTransform,ClassElement, ClassBuilder> - Specified by:
andThenin interfaceClassTransform- 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). -
transform
Returns the value of thetransformrecord component.- Returns:
- the value of the
transformrecord component
-
filter
Returns the value of thefilterrecord component.- Returns:
- the value of the
filterrecord 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<ClassTransform,ClassElement, ClassBuilder> - 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<ClassTransform,ClassElement, ClassBuilder> - 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<ClassTransform,ClassElement, ClassBuilder> - Parameters:
builder- the builder for the new entity
-