2026-03-17 13:31:18 -07:00

142 lines
4.4 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Property
*/
package com.tridium.program.module;
import com.tridium.program.module.ComponentWriter;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.HashSet;
import javax.baja.sys.Property;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ReflectUtil {
public static final int OK = 0;
public static final int WARN = 1;
public static final int ERR = 2;
HashMap methodMap = new HashMap();
static /* synthetic */ Class class$javax$baja$sys$BComponent;
public static ReflectUtil getInstance() {
return ReflectUtilHolder.INSTANCE;
}
public int getOverrideStatus(Method method) {
if (!this.isAccessible(method)) {
return 0;
}
return this.getOverrideStatus(method.getName(), method.getParameterTypes());
}
public int getPropertyStatus(Property property) {
ComponentWriter.CompProperty compProperty = new ComponentWriter.CompProperty(property);
if (this.getOverrideStatus(compProperty.getter(), new Class[0]) != 0) {
return 2;
}
if (this.getOverrideStatus(compProperty.setter(), compProperty.setParams) != 0) {
return 2;
}
return 0;
}
public int getOverrideStatus(String string, Class[] classArray) {
HashSet hashSet = (HashSet)this.methodMap.get(string);
if (hashSet == null) {
return 0;
}
Method[] methodArray = hashSet.toArray(new Method[hashSet.size()]);
int n = 0;
while (n < methodArray.length) {
if (this.isSameParameters(classArray, methodArray[n].getParameterTypes())) {
return Modifier.isFinal(methodArray[n].getModifiers()) + 1;
}
++n;
}
return 0;
}
public Class getDeclaringClass(Method method) {
Class[] classArray = method.getParameterTypes();
HashSet hashSet = (HashSet)this.methodMap.get(method.getName());
Method[] methodArray = hashSet.toArray(new Method[hashSet.size()]);
int n = 0;
while (n < methodArray.length) {
if (this.isSameParameters(classArray, methodArray[n].getParameterTypes())) {
return methodArray[n].getDeclaringClass();
}
++n;
}
return null;
}
private final boolean isSameParameters(Class[] classArray, Class[] classArray2) {
if (classArray.length != classArray2.length) {
return false;
}
int n = 0;
while (n < classArray.length) {
if (!classArray[n].equals(classArray2[n])) {
return false;
}
++n;
}
return true;
}
private final boolean isAccessible(Method method) {
int n = method.getModifiers();
boolean bl = false;
if (!Modifier.isStatic(n) && (Modifier.isPublic(n) || Modifier.isProtected(n))) {
bl = true;
}
return bl;
}
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());
}
}
protected ReflectUtil() {
Class clazz = class$javax$baja$sys$BComponent;
if (clazz == null) {
clazz = class$javax$baja$sys$BComponent = ReflectUtil.class("[Ljavax.baja.sys.BComponent;", false);
}
Method[] methodArray = clazz.getMethods();
int n = 0;
while (n < methodArray.length) {
String string = methodArray[n].getName();
if (this.isAccessible(methodArray[n])) {
if (this.methodMap.get(string) == null) {
this.methodMap.put(string, new HashSet());
}
HashSet hashSet = (HashSet)this.methodMap.get(string);
hashSet.add(methodArray[n]);
}
++n;
}
}
private static class ReflectUtilHolder {
private static final ReflectUtil INSTANCE = new ReflectUtil();
private ReflectUtilHolder() {
}
}
}