summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/mapping/entry/EntryFactory.java
blob: 5bd159f4b034513ccefcf7fabe3c8ad95f28d9d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
 * Copyright (c) 2015 Jeff Martin.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public
 * License v3.0 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl.html
 * <p>
 * Contributors:
 * Jeff Martin - initial API and implementation
 ******************************************************************************/

package cuchaz.enigma.mapping.entry;

import cuchaz.enigma.analysis.JarIndex;
import cuchaz.enigma.mapping.ClassMapping;
import cuchaz.enigma.mapping.FieldMapping;
import cuchaz.enigma.mapping.MethodDescriptor;
import cuchaz.enigma.mapping.MethodMapping;

public class EntryFactory {
	public static ClassEntry getObfClassEntry(JarIndex jarIndex, ClassMapping classMapping) {
		ClassEntry obfClassEntry = new ClassEntry(classMapping.getObfFullName());
		return obfClassEntry.buildClassEntry(jarIndex.getObfClassChain(obfClassEntry));
	}

	private static ClassEntry getObfClassEntry(ClassMapping classMapping) {
		return new ClassEntry(classMapping.getObfFullName());
	}

	public static ClassEntry getDeobfClassEntry(ClassMapping classMapping) {
		return new ClassEntry(classMapping.getDeobfName());
	}

	public static FieldEntry getObfFieldEntry(ClassMapping classMapping, FieldMapping fieldMapping) {
		return new FieldEntry(getObfClassEntry(classMapping), fieldMapping.getObfName(), fieldMapping.getObfDesc());
	}

	public static MethodEntry getMethodEntry(ClassEntry classEntry, String name, MethodDescriptor desc) {
		return new MethodEntry(classEntry, name, desc);
	}

	public static MethodEntry getObfMethodEntry(ClassEntry classEntry, MethodMapping methodMapping) {
		return getMethodEntry(classEntry, methodMapping.getObfName(), methodMapping.getObfDesc());
	}

	public static MethodEntry getObfMethodEntry(ClassMapping classMapping, MethodMapping methodMapping) {
		return getObfMethodEntry(getObfClassEntry(classMapping), methodMapping);
	}
}