diff options
author | zaaarf <zaaarf@proton.me> | 2023-08-27 09:49:12 +0200 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-08-27 09:49:12 +0200 |
commit | e07a0ac4238ecd8b2014237073e2daa5e6dee028 (patch) | |
tree | d816ca7c33e11141baded63f2a8a972692631422 /src/main/java/ftbsc/lll/mapper/tools/data | |
parent | 8f122b540e1b6795554647c7708a2f21164240fe (diff) |
feat: added support for field type descriptor
Diffstat (limited to 'src/main/java/ftbsc/lll/mapper/tools/data')
-rw-r--r-- | src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java | 10 | ||||
-rw-r--r-- | src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java | 24 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java b/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java index cdcec4d..4bd0af0 100644 --- a/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java +++ b/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java @@ -69,6 +69,16 @@ public class ClassData { } /** + * Adds a field to the target class. + * @param plain the name of the field + * @param mapped the mapped name of the field + * @param descriptor the plain type descriptor of the field + */ + public void addField(String plain, String mapped, String descriptor) { + this.fields.put(plain, new FieldData(this, plain, mapped, descriptor)); + } + + /** * Generates the reverse mappings for this class. * Should always be called only after the given mapper has finished * processing all classes. diff --git a/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java b/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java index bcc3985..e239d66 100644 --- a/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java +++ b/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java @@ -21,7 +21,14 @@ public class FieldData { public final String nameMapped; /** - * Constructs a new {@link FieldData}. + * The field's type descriptor. + * Some formats may not specify it; if this was created in one such format, + * this is going to be null. + */ + public final String descriptor; + + /** + * Constructs a new {@link FieldData} with unspecified descriptor. * @param parentClass the {@link ClassData} representation of the parent class * @param name the field name * @param nameMapped the mapped field name @@ -30,5 +37,20 @@ public class FieldData { this.parentClass = parentClass; this.name = name; this.nameMapped = nameMapped; + this.descriptor = null; + } + + /** + * Constructs a new {@link FieldData} with descriptor. + * @param parentClass the {@link ClassData} representation of the parent class + * @param name the field name + * @param nameMapped the mapped field name + * @param descriptor the field's type descriptor + */ + public FieldData(ClassData parentClass, String name, String nameMapped, String descriptor) { + this.parentClass = parentClass; + this.name = name; + this.nameMapped = nameMapped; + this.descriptor = descriptor; } } |