Class AbstractClassMappingImpl<M extends ClassMapping,P>
- java.lang.Object
-
- org.cadixdev.lorenz.impl.model.AbstractMappingImpl<M,P>
-
- org.cadixdev.lorenz.impl.model.AbstractClassMappingImpl<M,P>
-
- Type Parameters:
M- The type of the class mappingP- The type of the parent
- All Implemented Interfaces:
org.cadixdev.bombe.analysis.InheritanceCompletable,ClassMapping<M,P>,Mapping<M,P>,Reversible<M,P>
- Direct Known Subclasses:
InnerClassMappingImpl,TopLevelClassMappingImpl
public abstract class AbstractClassMappingImpl<M extends ClassMapping,P> extends AbstractMappingImpl<M,P> implements ClassMapping<M,P>
A basic implementation ofClassMapping.- Since:
- 0.2.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractClassMappingImpl(MappingSet mappings, java.lang.String obfuscatedName, java.lang.String deobfuscatedName)Creates a new class mapping, from the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.StringJoinerbuildToString()voidcomplete(org.cadixdev.bombe.analysis.InheritanceProvider provider, org.cadixdev.bombe.analysis.InheritanceProvider.ClassInfo info)java.util.Optional<FieldMapping>computeFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature)Attempts to locate a field mapping for the given obfuscated field signature.FieldMappingcreateFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature, java.lang.String deobfuscatedName)Creates a new field mapping, attached to this class mapping, using the given signature and de-obfuscated name.InnerClassMappingcreateInnerClassMapping(java.lang.String obfuscatedName, java.lang.String deobfuscatedName)Creates a new inner class mapping, attached to this class mapping, using the given obfuscated and de-obfuscated class name.MethodMappingcreateMethodMapping(org.cadixdev.bombe.type.signature.MethodSignature signature, java.lang.String deobfuscatedName)Creates a new method mapping, attached to this class mapping, using the given method signature and de-obfuscated name.booleanequals(java.lang.Object obj)java.util.Optional<FieldMapping>getFieldMapping(java.lang.String obfuscatedName)Gets a field mapping of the given obfuscated name of the class mapping, should it exist.java.util.Optional<FieldMapping>getFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature)Gets the field mapping of the given signature of the class mapping, should it exist.java.util.Collection<FieldMapping>getFieldMappings()Gets an immutable collection of all of the field mappings of the class mapping.java.util.Map<java.lang.String,FieldMapping>getFieldsByName()Gets an immutable map of all of the field mappings of the class mapping, by the field name.java.util.Optional<InnerClassMapping>getInnerClassMapping(java.lang.String obfuscatedName)Gets the inner class mapping of the given obfuscated name of the class mapping, should it exist.java.util.Collection<InnerClassMapping>getInnerClassMappings()Gets an immutable collection of all of the inner class mappings of the class mapping.java.util.Optional<MethodMapping>getMethodMapping(org.cadixdev.bombe.type.signature.MethodSignature signature)Gets the method mapping of the given method signature of the class mapping, should it exist.java.util.Collection<MethodMapping>getMethodMappings()Gets an immutable collection of all of the method mappings of the class mapping.booleanhasFieldMapping(java.lang.String obfuscatedName)Establishes whether the class mapping contains a field mapping of the given obfuscated name.booleanhasFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature)Establishes whether the class mapping contains a field mapping of the given signature.inthashCode()booleanhasInnerClassMapping(java.lang.String obfuscatedName)Establishes whether the class mapping contains a inner class mapping of the given obfuscated name.booleanhasMethodMapping(org.cadixdev.bombe.type.signature.MethodSignature signature)Establishes whether the class mapping contains a method mapping of the given obfuscated name.booleanisComplete()-
Methods inherited from class org.cadixdev.lorenz.impl.model.AbstractMappingImpl
get, getDeobfuscatedName, getMappings, getObfuscatedName, hasDeobfuscatedName, set, setDeobfuscatedName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.cadixdev.lorenz.model.ClassMapping
createFieldMapping, createFieldMapping, createFieldMapping, createInnerClassMapping, createMethodMapping, createMethodMapping, createMethodMapping, getDeobfuscatedPackage, getMethodMapping, getObfuscatedPackage, getOrCreateFieldMapping, getOrCreateFieldMapping, getOrCreateFieldMapping, getOrCreateFieldMapping, getOrCreateInnerClassMapping, getOrCreateMethodMapping, getOrCreateMethodMapping, getOrCreateMethodMapping, getSimpleDeobfuscatedName, getSimpleObfuscatedName, hasMappings, provideInheritance
-
Methods inherited from interface org.cadixdev.bombe.analysis.InheritanceCompletable
complete, complete
-
Methods inherited from interface org.cadixdev.lorenz.model.Mapping
copy, get, getDeobfuscatedName, getFullDeobfuscatedName, getFullObfuscatedName, getMappings, getObfuscatedName, getOrCreate, hasDeobfuscatedName, merge, set, setDeobfuscatedName
-
Methods inherited from interface org.cadixdev.lorenz.util.Reversible
reverse
-
-
-
-
Constructor Detail
-
AbstractClassMappingImpl
protected AbstractClassMappingImpl(MappingSet mappings, java.lang.String obfuscatedName, java.lang.String deobfuscatedName)
Creates a new class mapping, from the given parameters.- Parameters:
mappings- The mappings set, this mapping belongs toobfuscatedName- The obfuscated namedeobfuscatedName- The de-obfuscated name
-
-
Method Detail
-
getFieldMappings
public java.util.Collection<FieldMapping> getFieldMappings()
Description copied from interface:ClassMappingGets an immutable collection of all of the field mappings of the class mapping.- Specified by:
getFieldMappingsin interfaceClassMapping<M extends ClassMapping,P>- Returns:
- The field mappings
-
getFieldsByName
public java.util.Map<java.lang.String,FieldMapping> getFieldsByName()
Description copied from interface:ClassMappingGets an immutable map of all of the field mappings of the class mapping, by the field name.- Specified by:
getFieldsByNamein interfaceClassMapping<M extends ClassMapping,P>- Returns:
- The field mappings by name
-
getFieldMapping
public java.util.Optional<FieldMapping> getFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature)
Description copied from interface:ClassMappingGets the field mapping of the given signature of the class mapping, should it exist.Note: The field signature is looked up as-is, so if the loaded mappings use field types, looking up a signature without type will fail. Consider using
ClassMapping.getFieldMapping(String)orClassMapping.computeFieldMapping(FieldSignature).- Specified by:
getFieldMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The signature of the field- Returns:
- The field mapping, wrapped in an
Optional - See Also:
ClassMapping.getFieldMapping(String),ClassMapping.computeFieldMapping(FieldSignature)
-
getFieldMapping
public java.util.Optional<FieldMapping> getFieldMapping(java.lang.String obfuscatedName)
Description copied from interface:ClassMappingGets a field mapping of the given obfuscated name of the class mapping, should it exist. If multiple fields mappings with the same name (but different types) exist, only one of them will be returned.Note: This is not equivalent to calling
ClassMapping.getFieldMapping(FieldSignature)with anullfield type. UseClassMapping.computeFieldMapping(FieldSignature)to flexibly lookup field signatures with or without type.- Specified by:
getFieldMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
obfuscatedName- The obfuscated name of the field mapping- Returns:
- The field mapping, wrapped in an
Optional - See Also:
ClassMapping.getFieldMapping(FieldSignature),ClassMapping.computeFieldMapping(FieldSignature)
-
computeFieldMapping
public java.util.Optional<FieldMapping> computeFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature)
Description copied from interface:ClassMappingAttempts to locate a field mapping for the given obfuscated field signature. UnlikeClassMapping.getFieldMapping(FieldSignature)this method will attempt to match the field signature with or without type:If
FieldSignature.getType()is empty,ClassMapping.getFieldMapping(String)is returned. Otherwise, the signature is looked up with type. If that fails, the signature is looked up again without type. Note that it will insert a newFieldMappingwith the specified type for caching purposes.- Specified by:
computeFieldMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The (obfuscated) signature of the field- Returns:
- The field mapping, wrapped in an
Optional - See Also:
ClassMapping.getFieldMapping(FieldSignature),ClassMapping.getFieldMapping(String)
-
createFieldMapping
public FieldMapping createFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature, java.lang.String deobfuscatedName)
Description copied from interface:ClassMappingCreates a new field mapping, attached to this class mapping, using the given signature and de-obfuscated name.- Specified by:
createFieldMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The signature of the fielddeobfuscatedName- The de-obfuscated name of the field- Returns:
- The field mapping
-
hasFieldMapping
public boolean hasFieldMapping(org.cadixdev.bombe.type.signature.FieldSignature signature)
Description copied from interface:ClassMappingEstablishes whether the class mapping contains a field mapping of the given signature.- Specified by:
hasFieldMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The signature of the field mapping- Returns:
trueshould a field mapping of the given signature exists in the class mapping;falseotherwise
-
hasFieldMapping
public boolean hasFieldMapping(java.lang.String obfuscatedName)
Description copied from interface:ClassMappingEstablishes whether the class mapping contains a field mapping of the given obfuscated name.- Specified by:
hasFieldMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
obfuscatedName- The obfuscated name of the field mapping- Returns:
trueshould a field mapping of the given obfuscated name exists in the class mapping;falseotherwise
-
getMethodMappings
public java.util.Collection<MethodMapping> getMethodMappings()
Description copied from interface:ClassMappingGets an immutable collection of all of the method mappings of the class mapping.- Specified by:
getMethodMappingsin interfaceClassMapping<M extends ClassMapping,P>- Returns:
- The method mappings
-
getMethodMapping
public java.util.Optional<MethodMapping> getMethodMapping(org.cadixdev.bombe.type.signature.MethodSignature signature)
Description copied from interface:ClassMappingGets the method mapping of the given method signature of the class mapping, should it exist.- Specified by:
getMethodMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The signature of the method mapping- Returns:
- The method mapping, wrapped in an
Optional
-
createMethodMapping
public MethodMapping createMethodMapping(org.cadixdev.bombe.type.signature.MethodSignature signature, java.lang.String deobfuscatedName)
Description copied from interface:ClassMappingCreates a new method mapping, attached to this class mapping, using the given method signature and de-obfuscated name.- Specified by:
createMethodMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The method signaturedeobfuscatedName- The de-obfuscated name of the method- Returns:
- The method mapping
-
hasMethodMapping
public boolean hasMethodMapping(org.cadixdev.bombe.type.signature.MethodSignature signature)
Description copied from interface:ClassMappingEstablishes whether the class mapping contains a method mapping of the given obfuscated name.- Specified by:
hasMethodMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
signature- The signature of the method mapping- Returns:
trueshould a method mapping of the given obfuscated name exist in the class mapping;falseotherwise
-
getInnerClassMappings
public java.util.Collection<InnerClassMapping> getInnerClassMappings()
Description copied from interface:ClassMappingGets an immutable collection of all of the inner class mappings of the class mapping.- Specified by:
getInnerClassMappingsin interfaceClassMapping<M extends ClassMapping,P>- Returns:
- The inner class mappings
-
getInnerClassMapping
public java.util.Optional<InnerClassMapping> getInnerClassMapping(java.lang.String obfuscatedName)
Description copied from interface:ClassMappingGets the inner class mapping of the given obfuscated name of the class mapping, should it exist.- Specified by:
getInnerClassMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
obfuscatedName- The obfuscated name of the inner class mapping- Returns:
- The inner class mapping, wrapped in an
Optional
-
createInnerClassMapping
public InnerClassMapping createInnerClassMapping(java.lang.String obfuscatedName, java.lang.String deobfuscatedName)
Description copied from interface:ClassMappingCreates a new inner class mapping, attached to this class mapping, using the given obfuscated and de-obfuscated class name.- Specified by:
createInnerClassMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
obfuscatedName- The obfuscated class namedeobfuscatedName- The de-obfuscated class name- Returns:
- The class mapping
-
hasInnerClassMapping
public boolean hasInnerClassMapping(java.lang.String obfuscatedName)
Description copied from interface:ClassMappingEstablishes whether the class mapping contains a inner class mapping of the given obfuscated name.- Specified by:
hasInnerClassMappingin interfaceClassMapping<M extends ClassMapping,P>- Parameters:
obfuscatedName- The obfuscated name of the inner class mapping- Returns:
trueshould a inner class mapping of the given obfuscated name exist in the class mapping;falseotherwise
-
buildToString
protected java.util.StringJoiner buildToString()
- Overrides:
buildToStringin classAbstractMappingImpl<M extends ClassMapping,P>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractMappingImpl<M extends ClassMapping,P>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractMappingImpl<M extends ClassMapping,P>
-
isComplete
public boolean isComplete()
- Specified by:
isCompletein interfaceorg.cadixdev.bombe.analysis.InheritanceCompletable
-
complete
public void complete(org.cadixdev.bombe.analysis.InheritanceProvider provider, org.cadixdev.bombe.analysis.InheritanceProvider.ClassInfo info)- Specified by:
completein interfaceorg.cadixdev.bombe.analysis.InheritanceCompletable
-
-