diff options
Diffstat (limited to 'src/cuchaz/enigma/mapping/ProcyonEntryFactory.java')
| -rw-r--r-- | src/cuchaz/enigma/mapping/ProcyonEntryFactory.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/mapping/ProcyonEntryFactory.java b/src/cuchaz/enigma/mapping/ProcyonEntryFactory.java new file mode 100644 index 0000000..eb0563c --- /dev/null +++ b/src/cuchaz/enigma/mapping/ProcyonEntryFactory.java | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | package cuchaz.enigma.mapping; | ||
| 2 | |||
| 3 | import com.strobel.assembler.metadata.FieldDefinition; | ||
| 4 | import com.strobel.assembler.metadata.MethodDefinition; | ||
| 5 | |||
| 6 | |||
| 7 | public class ProcyonEntryFactory { | ||
| 8 | |||
| 9 | public static FieldEntry getFieldEntry(FieldDefinition def) { | ||
| 10 | return new FieldEntry( | ||
| 11 | new ClassEntry(def.getDeclaringType().getInternalName()), | ||
| 12 | def.getName(), | ||
| 13 | new Type(def.getErasedSignature()) | ||
| 14 | ); | ||
| 15 | } | ||
| 16 | |||
| 17 | public static MethodEntry getMethodEntry(MethodDefinition def) { | ||
| 18 | return new MethodEntry( | ||
| 19 | new ClassEntry(def.getDeclaringType().getInternalName()), | ||
| 20 | def.getName(), | ||
| 21 | new Signature(def.getErasedSignature()) | ||
| 22 | ); | ||
| 23 | } | ||
| 24 | |||
| 25 | public static ConstructorEntry getConstructorEntry(MethodDefinition def) { | ||
| 26 | if (def.isTypeInitializer()) { | ||
| 27 | return new ConstructorEntry( | ||
| 28 | new ClassEntry(def.getDeclaringType().getInternalName()) | ||
| 29 | ); | ||
| 30 | } else { | ||
| 31 | return new ConstructorEntry( | ||
| 32 | new ClassEntry(def.getDeclaringType().getInternalName()), | ||
| 33 | new Signature(def.getErasedSignature()) | ||
| 34 | ); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | public static BehaviorEntry getBehaviorEntry(MethodDefinition def) { | ||
| 39 | if (def.isConstructor() || def.isTypeInitializer()) { | ||
| 40 | return getConstructorEntry(def); | ||
| 41 | } else { | ||
| 42 | return getMethodEntry(def); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||