summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/api/service/ObfuscationTestService.java
blob: c580f0933aea4abb00d1c04a9e3569454703b1a6 (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
package cuchaz.enigma.api.service;

import com.google.common.base.Strings;
import cuchaz.enigma.translation.representation.entry.ClassEntry;
import cuchaz.enigma.translation.representation.entry.Entry;

public interface ObfuscationTestService extends EnigmaService {
	EnigmaServiceType<ObfuscationTestService> TYPE = EnigmaServiceType.create("obfuscation_test");

	boolean testDeobfuscated(Entry<?> entry);

	final class Default implements ObfuscationTestService {
		Default INSTANCE = new Default();

		Default() {
		}

		@Override
		public boolean testDeobfuscated(Entry<?> entry) {
			if (entry instanceof ClassEntry) {
				String packageName = ((ClassEntry) entry).getPackageName();
				return Strings.isNullOrEmpty(packageName);
			}
			return false;
		}
	}
}