Class ClassProcessor.TransformationContext
java.lang.Object
net.neoforged.neoforgespi.transformation.ClassProcessor.TransformationContext
- All Implemented Interfaces:
SimpleTransformationContext
- Enclosing interface:
ClassProcessor
public static final class ClassProcessor.TransformationContext
extends Object
implements SimpleTransformationContext
Context available when processing a class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiConsumer<String, String[]> private final booleanprivate final Supplier<byte[]> private final org.objectweb.asm.tree.ClassNodeprivate final Type -
Constructor Summary
ConstructorsConstructorDescriptionTransformationContext(Type type, org.objectweb.asm.tree.ClassNode node, boolean empty, BiConsumer<String, String[]> auditTrail, Supplier<byte[]> initialSha256) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd audit activity for this transformation.booleanempty()Returns whether the class was empty when provided to this transformer.byte[]Returns the SHA-256 hash of the original class bytecode.org.objectweb.asm.tree.ClassNodenode()Returns the class being transformed.type()Returns .
-
Field Details
-
type
-
node
private final org.objectweb.asm.tree.ClassNode node -
empty
private final boolean empty -
auditTrail
-
initialSha256
-
-
Constructor Details
-
TransformationContext
@Internal public TransformationContext(Type type, org.objectweb.asm.tree.ClassNode node, boolean empty, BiConsumer<String, String[]> auditTrail, Supplier<byte[]> initialSha256)
-
-
Method Details
-
type
Returns . the type of the class being transformed- Specified by:
typein interfaceSimpleTransformationContext- Returns:
-
node
public org.objectweb.asm.tree.ClassNode node()Returns the class being transformed. Modifications will be reflected in the output bytecode (and the loaded class).- Returns:
- the class being transformed
-
empty
public boolean empty()Returns whether the class was empty when provided to this transformer. Note that a class might not exist on disk but still returnfalsehere, if an earlier transformer provided it.- Specified by:
emptyin interfaceSimpleTransformationContext- Returns:
- whether the class was empty when provided to this transformer
-
audit
Add audit activity for this transformation.- Parameters:
activity- what was done to the classcontext- any additional information to include
-
initialSha256
public byte[] initialSha256()Returns the SHA-256 hash of the original class bytecode.- Specified by:
initialSha256in interfaceSimpleTransformationContext- Returns:
- the SHA-256 hash of the original class bytecode
-