public final class MemberInfo extends java.lang.Object implements ITargetSelectorRemappable, ITargetSelectorConstructor
Target selector, also used as a general-purpose information bundle about a
member (method or field) parsed from a String token in another annotation,
this is used where target members need to be specified as Strings in order to
parse the String representation to something useful. See
ITargetSelector for other supported selector types.
Some examples:
// references a method or field called func_1234_a, if there are multiple // members with the same signature, matches the first occurrence func_1234_a // references a method or field called func_1234_a, if there are multiple // members with the same signature, matches all occurrences func_1234_a* // references a method called func_1234_a which takes 3 ints and returns // a bool func_1234_a(III)Z // references a field called field_5678_z which is a String field_5678_z:Ljava/lang/String; // references a ctor which takes a single String argument <init>(Ljava/lang/String;)V // references a method called func_1234_a in class foo.bar.Baz Lfoo/bar/Baz;func_1234_a // references a field called field_5678_z in class com.example.Dave Lcom/example/Dave;field_5678_z // references a method called func_1234_a in class foo.bar.Baz which takes // three doubles and returns void Lfoo/bar/Baz;func_1234_a(DDD)V // alternate syntax for the same foo.bar.Baz.func_1234_a(DDD)V
| Constructor and Description |
|---|
MemberInfo(org.objectweb.asm.tree.AbstractInsnNode insn)
Initialise a MemberInfo using the supplied insn which must be an instance
of MethodInsnNode or FieldInsnNode.
|
MemberInfo(IMapping<?> mapping)
Initialise a MemberInfo using the supplied mapping object
|
MemberInfo(java.lang.String name,
boolean matchAll)
ctor
|
MemberInfo(java.lang.String name,
java.lang.String owner,
boolean matchAll)
ctor
|
MemberInfo(java.lang.String name,
java.lang.String owner,
java.lang.String desc)
ctor
|
MemberInfo(java.lang.String name,
java.lang.String owner,
java.lang.String desc,
boolean matchAll)
ctor
|
MemberInfo(java.lang.String name,
java.lang.String owner,
java.lang.String desc,
boolean matchAll,
java.lang.String unparsed)
ctor
|
| Modifier and Type | Method and Description |
|---|---|
MappingField |
asFieldMapping()
Returns this MemberInfo as a mapping field
|
IMapping<?> |
asMapping()
Returns this MemberInfo as a
MappingField or
MappingMethod |
MappingMethod |
asMethodMapping()
Returns this MemberInfo as a mapping method
|
ITargetSelector |
attach(IMixinContext context)
Attach this selector to the specified context.
|
ITargetSelector |
configure(java.lang.String... args)
Configure and return a modified version of this selector by consuming the
supplied arguments.
|
boolean |
equals(java.lang.Object obj) |
static MemberInfo |
fromMapping(IMapping<?> mapping)
Return the supplied mapping parsed as a MemberInfo
|
java.lang.String |
getDesc()
Get the member descriptor, can be null
|
int |
getMatchCount()
Number of candidates which this selector should match
|
java.lang.String |
getName()
Get the member name, can be null
|
java.lang.String |
getOwner()
Get the member owner, can be null
|
int |
hashCode() |
boolean |
isClassInitialiser()
Get whether this member represents a class initialiser
|
boolean |
isConstructor()
Get whether this member represents a constructor
|
boolean |
isField()
Get whether this MemberInfo is definitely a field, the output of this
method is undefined if
isFullyQualified() returns false. |
boolean |
isFullyQualified()
Get whether this reference is fully qualified
|
boolean |
isInitialiser()
Get whether this member represents a constructor or class initialiser
|
MatchResult |
match(org.objectweb.asm.tree.AbstractInsnNode insn)
Test whether this selector matches the supplied instruction node
|
<TNode> MatchResult |
match(ElementNode<TNode> node)
Test whether this selector matches the supplied element node
|
MatchResult |
matches(java.lang.String owner,
java.lang.String name,
java.lang.String desc)
Test whether this selector matches the supplied values.
|
ITargetSelectorRemappable |
move(java.lang.String newOwner)
Create a new version of this member with a different owner
|
ITargetSelector |
next()
Get the next target selector in this path (or null if this
selector is the last selector in the chain.
|
static MemberInfo |
parse(java.lang.String input,
IReferenceMapper refMapper,
java.lang.String className)
Parse a MemberInfo from a string
|
ITargetSelectorRemappable |
remapUsing(MappingMethod srgMethod,
boolean setOwner)
Create a remapped version of this member using the supplied method data
|
java.lang.String |
toCtorDesc()
Returns the constructor descriptor represented by this
MemberInfo, returns null if no descriptor is present.
|
java.lang.String |
toCtorType()
Returns the constructor type represented by this MemberInfo
|
java.lang.String |
toDescriptor()
Returns this MemberInfo as a java-style descriptor
|
java.lang.String |
toSrg()
Deprecated.
use m.asMethodMapping().serialise() instead
|
java.lang.String |
toString() |
ITargetSelectorRemappable |
transform(java.lang.String newDesc)
Create a new version of this member with a different descriptor
|
MemberInfo |
validate()
Perform ultra-simple validation of the descriptor, checks that the parts
of the descriptor are basically sane.
|
public MemberInfo(java.lang.String name,
boolean matchAll)
name - Member name, must not be nullmatchAll - true if this info should match all matching references,
or only the firstpublic MemberInfo(java.lang.String name,
java.lang.String owner,
boolean matchAll)
name - Member name, must not be nullowner - Member owner, can be null otherwise must be in internal form
without L;matchAll - true if this info should match all matching references,
or only the firstpublic MemberInfo(java.lang.String name,
java.lang.String owner,
java.lang.String desc)
name - Member name, must not be nullowner - Member owner, can be null otherwise must be in internal form
without L;desc - Member descriptor, can be nullpublic MemberInfo(java.lang.String name,
java.lang.String owner,
java.lang.String desc,
boolean matchAll)
name - Member name, must not be nullowner - Member owner, can be null otherwise must be in internal form
without L;desc - Member descriptor, can be nullmatchAll - True to match all matching members, not just the firstpublic MemberInfo(java.lang.String name,
java.lang.String owner,
java.lang.String desc,
boolean matchAll,
java.lang.String unparsed)
name - Member name, must not be nullowner - Member owner, can be null otherwise must be in internal form
without L;desc - Member descriptor, can be nullmatchAll - True to match all matching members, not just the firstpublic MemberInfo(org.objectweb.asm.tree.AbstractInsnNode insn)
insn - instruction node to copy values frompublic MemberInfo(IMapping<?> mapping)
mapping - Mapping object to copy values frompublic ITargetSelector next()
ITargetSelectornext in interface ITargetSelectorpublic java.lang.String getOwner()
ITargetSelectorByNamegetOwner in interface ITargetSelectorByNamepublic java.lang.String getName()
ITargetSelectorByNamegetName in interface ITargetSelectorByNamepublic java.lang.String getDesc()
ITargetSelectorByNamegetDesc in interface ITargetSelectorByNamepublic int getMatchCount()
ITargetSelectorgetMatchCount in interface ITargetSelectorpublic java.lang.String toString()
toString in class java.lang.Object@Deprecated public java.lang.String toSrg()
public java.lang.String toDescriptor()
toDescriptor in interface ITargetSelectorByNamepublic java.lang.String toCtorType()
toCtorType in interface ITargetSelectorConstructorpublic java.lang.String toCtorDesc()
toCtorDesc in interface ITargetSelectorConstructorpublic IMapping<?> asMapping()
MappingField or
MappingMethodasMapping in interface ITargetSelectorRemappablepublic MappingMethod asMethodMapping()
asMethodMapping in interface ITargetSelectorRemappablepublic MappingField asFieldMapping()
asFieldMapping in interface ITargetSelectorRemappablepublic boolean isFullyQualified()
ITargetSelectorByNameisFullyQualified in interface ITargetSelectorByNamepublic boolean isField()
isFullyQualified() returns false.isField in interface ITargetSelectorByNamepublic boolean isConstructor()
isConstructor in interface ITargetSelectorByNamepublic boolean isClassInitialiser()
isClassInitialiser in interface ITargetSelectorByNamepublic boolean isInitialiser()
isInitialiser in interface ITargetSelectorByNamepublic MemberInfo validate() throws InvalidMemberDescriptorException
validate in interface ITargetSelectorInvalidMemberDescriptorException - if any validation check failspublic <TNode> MatchResult match(ElementNode<TNode> node)
ITargetSelectormatch in interface ITargetSelectorTNode - node typenode - node node to testpublic MatchResult match(org.objectweb.asm.tree.AbstractInsnNode insn)
ITargetSelectormatch in interface ITargetSelectorinsn - instruction node to testpublic MatchResult matches(java.lang.String owner, java.lang.String name, java.lang.String desc)
ITargetSelectorByNamematches in interface ITargetSelectorByNameowner - Owner to compare with, null to skipname - Name to compare with, null to skipdesc - Signature to compare with, null to skippublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic ITargetSelector configure(java.lang.String... args)
ITargetSelectorIn other words, calling configure("foo") when this object is already configured according to "foo" may simply return this object, or might return an identically-configured copy.
configure in interface ITargetSelectorargs - Configuration argumentspublic ITargetSelector attach(IMixinContext context) throws InvalidSelectorException
ITargetSelectorInvalidSelectorException is thrown.attach in interface ITargetSelectorcontext - Context to attach toInvalidSelectorExceptionpublic ITargetSelectorRemappable move(java.lang.String newOwner)
move in interface ITargetSelectorRemappablenewOwner - New owner for this memberpublic ITargetSelectorRemappable transform(java.lang.String newDesc)
transform in interface ITargetSelectorRemappablenewDesc - New descriptor for this memberpublic ITargetSelectorRemappable remapUsing(MappingMethod srgMethod, boolean setOwner)
remapUsing in interface ITargetSelectorRemappablesrgMethod - SRG method data to usesetOwner - True to set the owner as well as the namepublic static MemberInfo parse(java.lang.String input, IReferenceMapper refMapper, java.lang.String className)
input - String to parse MemberInfo fromrefMapper - Reference mapper to useclassName - Class context to use for remappingpublic static MemberInfo fromMapping(IMapping<?> mapping)
mapping - mapping to parse