summaryrefslogtreecommitdiff
path: root/test/cuchaz/enigma/EntryFactory.java
diff options
context:
space:
mode:
authorGravatar jeff2015-02-08 21:29:25 -0500
committerGravatar jeff2015-02-08 21:29:25 -0500
commited9b5cdfc648e86fd463bfa8d86b94c41671e14c (patch)
tree2619bbc7e04dfa3b82f8dfd3b1d31f529766cd4b /test/cuchaz/enigma/EntryFactory.java
downloadenigma-fork-ed9b5cdfc648e86fd463bfa8d86b94c41671e14c.tar.gz
enigma-fork-ed9b5cdfc648e86fd463bfa8d86b94c41671e14c.tar.xz
enigma-fork-ed9b5cdfc648e86fd463bfa8d86b94c41671e14c.zip
switch all classes to new signature/type system
Diffstat (limited to 'test/cuchaz/enigma/EntryFactory.java')
-rw-r--r--test/cuchaz/enigma/EntryFactory.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/cuchaz/enigma/EntryFactory.java b/test/cuchaz/enigma/EntryFactory.java
new file mode 100644
index 0000000..fa90779
--- /dev/null
+++ b/test/cuchaz/enigma/EntryFactory.java
@@ -0,0 +1,67 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.\
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the GNU Public License v3.0
6 * which accompanies this distribution, and is available at
7 * http://www.gnu.org/licenses/gpl.html
8 *
9 * Contributors:
10 * Jeff Martin - initial API and implementation
11 ******************************************************************************/
12package cuchaz.enigma;
13
14import cuchaz.enigma.analysis.EntryReference;
15import cuchaz.enigma.mapping.BehaviorEntry;
16import cuchaz.enigma.mapping.ClassEntry;
17import cuchaz.enigma.mapping.ConstructorEntry;
18import cuchaz.enigma.mapping.FieldEntry;
19import cuchaz.enigma.mapping.MethodEntry;
20import cuchaz.enigma.mapping.Signature;
21
22public class EntryFactory {
23
24 public static ClassEntry newClass(String name) {
25 return new ClassEntry(name);
26 }
27
28 public static FieldEntry newField(String className, String fieldName) {
29 return newField(newClass(className), fieldName);
30 }
31
32 public static FieldEntry newField(ClassEntry classEntry, String fieldName) {
33 return new FieldEntry(classEntry, fieldName);
34 }
35
36 public static MethodEntry newMethod(String className, String methodName, String methodSignature) {
37 return newMethod(newClass(className), methodName, methodSignature);
38 }
39
40 public static MethodEntry newMethod(ClassEntry classEntry, String methodName, String methodSignature) {
41 return new MethodEntry(classEntry, methodName, new Signature(methodSignature));
42 }
43
44 public static ConstructorEntry newConstructor(String className, String signature) {
45 return newConstructor(newClass(className), signature);
46 }
47
48 public static ConstructorEntry newConstructor(ClassEntry classEntry, String signature) {
49 return new ConstructorEntry(classEntry, new Signature(signature));
50 }
51
52 public static EntryReference<FieldEntry,BehaviorEntry> newFieldReferenceByMethod(FieldEntry fieldEntry, String callerClassName, String callerName, String callerSignature) {
53 return new EntryReference<FieldEntry,BehaviorEntry>(fieldEntry, "", newMethod(callerClassName, callerName, callerSignature));
54 }
55
56 public static EntryReference<FieldEntry,BehaviorEntry> newFieldReferenceByConstructor(FieldEntry fieldEntry, String callerClassName, String callerSignature) {
57 return new EntryReference<FieldEntry,BehaviorEntry>(fieldEntry, "", newConstructor(callerClassName, callerSignature));
58 }
59
60 public static EntryReference<BehaviorEntry,BehaviorEntry> newBehaviorReferenceByMethod(BehaviorEntry behaviorEntry, String callerClassName, String callerName, String callerSignature) {
61 return new EntryReference<BehaviorEntry,BehaviorEntry>(behaviorEntry, "", newMethod(callerClassName, callerName, callerSignature));
62 }
63
64 public static EntryReference<BehaviorEntry,BehaviorEntry> newBehaviorReferenceByConstructor(BehaviorEntry behaviorEntry, String callerClassName, String callerSignature) {
65 return new EntryReference<BehaviorEntry,BehaviorEntry>(behaviorEntry, "", newConstructor(callerClassName, callerSignature));
66 }
67}