133 lines
3.9 KiB
Java
133 lines
3.9 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.nre.util.TextUtil
|
|
*/
|
|
package com.tridium.sys.schema;
|
|
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import javax.baja.nre.util.TextUtil;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
class MethodMap {
|
|
static final Class[] noParams = new Class[0];
|
|
static final Class wildcard;
|
|
private HashMap map;
|
|
private Class[] oneParam;
|
|
static /* synthetic */ Class class$com$tridium$sys$schema$MethodMap;
|
|
|
|
Method getMethod(String string, Class clazz) {
|
|
this.oneParam[0] = clazz;
|
|
return this.getMethod(string, this.oneParam);
|
|
}
|
|
|
|
Method getMethod(String string, Class[] classArray) {
|
|
Object v = this.map.get(string);
|
|
if (v != null) {
|
|
if (v instanceof Method) {
|
|
Method method = (Method)v;
|
|
if (this.isMatch(method, classArray)) {
|
|
return method;
|
|
}
|
|
} else {
|
|
ArrayList arrayList = (ArrayList)v;
|
|
int n = 0;
|
|
while (n < arrayList.size()) {
|
|
Method method = (Method)arrayList.get(n);
|
|
if (this.isMatch(method, classArray)) {
|
|
return method;
|
|
}
|
|
++n;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
boolean isMatch(Method method, Class[] classArray) {
|
|
Class<?>[] classArray2 = method.getParameterTypes();
|
|
if (classArray2.length != classArray.length) {
|
|
return false;
|
|
}
|
|
int n = 0;
|
|
while (n < classArray2.length) {
|
|
Class clazz = classArray[n];
|
|
if (clazz != wildcard && clazz != classArray2[n]) {
|
|
return false;
|
|
}
|
|
++n;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
String toString(Class[] classArray) {
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
stringBuffer.append('(');
|
|
int n = 0;
|
|
while (n < classArray.length) {
|
|
if (n > 0) {
|
|
stringBuffer.append(',');
|
|
}
|
|
stringBuffer.append(TextUtil.getClassName((Class)classArray[n]));
|
|
++n;
|
|
}
|
|
stringBuffer.append(')');
|
|
return stringBuffer.toString();
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.oneParam = new Class[1];
|
|
}
|
|
|
|
MethodMap(Class clazz) {
|
|
this.this();
|
|
Method[] methodArray = clazz.getMethods();
|
|
int n = methodArray.length;
|
|
this.map = new HashMap(n * 3);
|
|
int n2 = 0;
|
|
while (n2 < n) {
|
|
Method method = methodArray[n2];
|
|
String string = method.getName();
|
|
Object v = this.map.get(string);
|
|
if (v == null) {
|
|
this.map.put(string, method);
|
|
} else if (v instanceof Method) {
|
|
ArrayList<Object> arrayList = new ArrayList<Object>(5);
|
|
arrayList.add(v);
|
|
arrayList.add(method);
|
|
this.map.put(string, arrayList);
|
|
} else {
|
|
((ArrayList)v).add(method);
|
|
}
|
|
++n2;
|
|
}
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$com$tridium$sys$schema$MethodMap;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$sys$schema$MethodMap = MethodMap.class("[Lcom.tridium.sys.schema.MethodMap;", false);
|
|
}
|
|
wildcard = clazz;
|
|
}
|
|
}
|
|
|