public final class MemberInfo
extends java.lang.Object
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.
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
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
desc
Member descriptor, can be null
|
boolean |
matchAll
True to match all matching members, not just the first
|
java.lang.String |
name
Member name, can be null to match any member
|
java.lang.String |
owner
Member owner in internal form but without L;, can be null
|
| Constructor and Description |
|---|
MemberInfo(org.spongepowered.asm.lib.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
|
boolean |
equals(java.lang.Object obj) |
static MemberInfo |
fromMapping(IMapping<?> mapping)
Return the supplied mapping parsed as a MemberInfo
|
java.lang.String |
getReturnType()
Get the return type for this MemberInfo, if the decriptor is present,
returns null if the descriptor is absent or if this MemberInfo represents
a field
|
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
|
boolean |
matches(java.lang.String name,
java.lang.String desc)
Test whether this MemberInfo matches the supplied values.
|
boolean |
matches(java.lang.String name,
java.lang.String desc,
int ordinal)
Test whether this MemberInfo matches the supplied values at the specified
ordinal.
|
boolean |
matches(java.lang.String owner,
java.lang.String name,
java.lang.String desc)
Test whether this MemberInfo matches the supplied values.
|
boolean |
matches(java.lang.String owner,
java.lang.String name,
java.lang.String desc,
int ordinal)
Test whether this MemberInfo matches the supplied values at the specified
ordinal.
|
MemberInfo |
move(java.lang.String newOwner)
Create a new version of this member with a different owner
|
static MemberInfo |
parse(java.lang.String string)
Parse a MemberInfo from a string
|
static MemberInfo |
parse(java.lang.String string,
IMixinContext context)
Parse a MemberInfo from a string
|
static MemberInfo |
parseAndValidate(java.lang.String string)
Parse a MemberInfo from a string and perform validation
|
static MemberInfo |
parseAndValidate(java.lang.String string,
IMixinContext context)
Parse a MemberInfo from a string and perform validation
|
MemberInfo |
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() |
MemberInfo |
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 final java.lang.String owner
public final java.lang.String name
public final java.lang.String desc
public final boolean matchAll
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.spongepowered.asm.lib.tree.AbstractInsnNode insn)
insn - instruction node to copy values frompublic MemberInfo(IMapping<?> mapping)
mapping - Mapping object to copy values frompublic java.lang.String toString()
toString in class java.lang.Object@Deprecated public java.lang.String toSrg()
public java.lang.String toDescriptor()
public java.lang.String toCtorType()
public java.lang.String toCtorDesc()
public java.lang.String getReturnType()
public IMapping<?> asMapping()
MappingField or
MappingMethodpublic MappingMethod asMethodMapping()
public MappingField asFieldMapping()
public boolean isFullyQualified()
public boolean isField()
isFullyQualified() returns false.public boolean isConstructor()
public boolean isClassInitialiser()
public boolean isInitialiser()
public MemberInfo validate() throws InvalidMemberDescriptorException
InvalidMemberDescriptorException - if any validation check failspublic boolean matches(java.lang.String owner,
java.lang.String name,
java.lang.String desc)
owner - Owner to compare with, null to skipname - Name to compare with, null to skipdesc - Signature to compare with, null to skippublic boolean matches(java.lang.String owner,
java.lang.String name,
java.lang.String desc,
int ordinal)
owner - Owner to compare with, null to skipname - Name to compare with, null to skipdesc - Signature to compare with, null to skipordinal - ordinal position within the class, used to honour the
matchAll semanticspublic boolean matches(java.lang.String name,
java.lang.String desc)
name - Name to compare with, null to skipdesc - Signature to compare with, null to skippublic boolean matches(java.lang.String name,
java.lang.String desc,
int ordinal)
name - Name to compare with, null to skipdesc - Signature to compare with, null to skipordinal - ordinal position within the class, used to honour the
matchAll semanticspublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic MemberInfo move(java.lang.String newOwner)
newOwner - New owner for this memberpublic MemberInfo transform(java.lang.String newDesc)
newDesc - New descriptor for this memberpublic MemberInfo remapUsing(MappingMethod srgMethod, boolean setOwner)
srgMethod - SRG method data to usesetOwner - True to set the owner as well as the namepublic static MemberInfo parseAndValidate(java.lang.String string) throws InvalidMemberDescriptorException
string - String to parse MemberInfo fromInvalidMemberDescriptorExceptionpublic static MemberInfo parseAndValidate(java.lang.String string, IMixinContext context) throws InvalidMemberDescriptorException
string - String to parse MemberInfo fromcontext - Context to use for reference mappingInvalidMemberDescriptorExceptionpublic static MemberInfo parse(java.lang.String string)
string - String to parse MemberInfo frompublic static MemberInfo parse(java.lang.String string, IMixinContext context)
string - String to parse MemberInfo fromcontext - Context to use for reference mappingpublic static MemberInfo fromMapping(IMapping<?> mapping)
mapping - mapping to parse