improved ref
This commit is contained in:
parent
f6da4781e7
commit
03bf00a43d
@ -70,7 +70,7 @@ public class SimpleReflection {
|
|||||||
}
|
}
|
||||||
Field field = fields.get(fieldName);
|
Field field = fields.get(fieldName);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
field.set(instance, value);
|
field.set(instance, value);
|
||||||
@ -86,7 +86,7 @@ public class SimpleReflection {
|
|||||||
}
|
}
|
||||||
Field field = fields.get(fieldName);
|
Field field = fields.get(fieldName);
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return field.get(instance);
|
return field.get(instance);
|
||||||
@ -103,7 +103,7 @@ public class SimpleReflection {
|
|||||||
}
|
}
|
||||||
Field field = fields.get(fieldName);
|
Field field = fields.get(fieldName);
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return (T) field.get(instance);
|
return (T) field.get(instance);
|
||||||
@ -113,7 +113,7 @@ public class SimpleReflection {
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class getListType(Field field) {
|
public static Class getListType(Field field) {
|
||||||
Type genericType = field.getGenericType();
|
Type genericType = field.getGenericType();
|
||||||
try {
|
try {
|
||||||
if (ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
|
if (ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
|
||||||
@ -127,7 +127,7 @@ public class SimpleReflection {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class[] getMapType(Field field) {
|
public static Class[] getMapType(Field field) {
|
||||||
Class[] mapType = new Class[2];
|
Class[] mapType = new Class[2];
|
||||||
try {
|
try {
|
||||||
Type genericType = field.getGenericType();
|
Type genericType = field.getGenericType();
|
||||||
@ -139,6 +139,6 @@ public class SimpleReflection {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
}
|
||||||
return mapType[1] == null ? null : mapType ;
|
return mapType[1] == null ? null : mapType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user