@HashCodeAndEqualsPlugin.Enhance public class RenamingPlugin extends AsmVisitorWrapper.AbstractBase implements Plugin
Modifier and Type | Class and Description |
---|---|
static interface |
RenamingPlugin.Renaming
A renaming function tho transform a type's binary name.
|
protected static class |
RenamingPlugin.RenamingRemapper
An ASM
Remapper to apply renamings. |
Plugin.Engine, Plugin.Factory, Plugin.ForElementMatcher, Plugin.NoOp, Plugin.WithInitialization, Plugin.WithPreprocessor
ElementMatcher.Junction<S>
AsmVisitorWrapper.AbstractBase, AsmVisitorWrapper.Compound, AsmVisitorWrapper.ForDeclaredFields, AsmVisitorWrapper.ForDeclaredMethods, AsmVisitorWrapper.NoOp
NO_FLAGS
Constructor and Description |
---|
RenamingPlugin(RenamingPlugin.Renaming renaming)
Creates a renaming plugin for the given renaming that applies to all types.
|
RenamingPlugin(RenamingPlugin.Renaming renaming,
ElementMatcher<? super TypeDescription> matcher)
Creates a renaming plugin for the given renaming and type matcher.
|
RenamingPlugin(String pattern,
String replacement)
Creates a renaming plugin for a given regular expression and replacement that applies to all types.
|
RenamingPlugin(String pattern,
String replacement,
String prefix)
Creates a renaming plugin for a given regular expression and replacement that applies to all types that start with a given prefix.
|
Modifier and Type | Method and Description |
---|---|
DynamicType.Builder<?> |
apply(DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassFileLocator classFileLocator)
Applies this plugin.
|
void |
close() |
boolean |
matches(TypeDescription target)
Matches a target against this element matcher.
|
ClassVisitor |
wrap(TypeDescription instrumentedType,
ClassVisitor classVisitor,
Implementation.Context implementationContext,
TypePool typePool,
FieldList<FieldDescription.InDefinedShape> fields,
MethodList<?> methods,
int writerFlags,
int readerFlags)
Applies a
ClassVisitorWrapper to the creation of a DynamicType . |
mergeReader, mergeWriter
public RenamingPlugin(String pattern, String replacement)
pattern
- The pattern to consider.replacement
- The replacement to apply if the supplied pattern is matched.public RenamingPlugin(String pattern, String replacement, String prefix)
pattern
- The pattern to consider.replacement
- The replacement to apply if the supplied pattern is matched.prefix
- The prefix for types to consider for renaming.public RenamingPlugin(RenamingPlugin.Renaming renaming)
renaming
- The renaming to apply.public RenamingPlugin(RenamingPlugin.Renaming renaming, ElementMatcher<? super TypeDescription> matcher)
renaming
- The renaming to apply.matcher
- A matcher that determines what types to consider for renaming.public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator)
apply
in interface Plugin
builder
- The builder to use as a basis for the applied transformation.typeDescription
- The type being transformed.classFileLocator
- A class file locator that can locate other types in the scope of the project.public boolean matches(TypeDescription target)
matches
in interface ElementMatcher<TypeDescription>
target
- The instance to be matched or null
.true
if the given element is matched by this matcher or false
otherwise.public void close()
close
in interface Closeable
close
in interface AutoCloseable
public ClassVisitor wrap(TypeDescription instrumentedType, ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags)
ClassVisitorWrapper
to the creation of a DynamicType
.wrap
in interface AsmVisitorWrapper
instrumentedType
- The instrumented type.classVisitor
- A ClassVisitor
to become the new primary class visitor to which the created
DynamicType
is written to.implementationContext
- The implementation context of the current instrumentation.typePool
- The type pool that was provided for the class creation.fields
- The instrumented type's fields.methods
- The instrumented type's methods non-ignored declared and virtually inherited methods.writerFlags
- The ASM ClassWriter
flags to consider.readerFlags
- The ASM ClassReader
flags to consider.ClassVisitor
that usually delegates to the ClassVisitor
delivered in the argument.Copyright © 2014–2023. All rights reserved.