MCPcopy Create free account
hub / github.com/cinit/TMoe / getInstanceObject

Method getInstanceObject

app/src/main/java/cc/ioctl/tmoe/util/Reflex.java:873–883  ·  view source on GitHub ↗
(Object obj, String name, Class<T> type)

Source from the content-addressed store, hash-verified

871 }
872
873 public static <T> T getInstanceObject(Object obj, String name, Class<T> type) throws NoSuchFieldException {
874 Class<?> clazz = obj.getClass();
875 Field f = findField(clazz, type, name);
876 f.setAccessible(true);
877 try {
878 return (T) f.get(obj);
879 } catch (IllegalAccessException e) {
880 // should not happen
881 throw new AssertionError(e);
882 }
883 }
884
885 public static void setInstanceObject(@NonNull Object obj, @NonNull String name,
886 @Nullable Object value) throws NoSuchFieldException {

Callers 4

isFinishingMethod · 0.95
getMessageForTL_errorMethod · 0.80

Calls 2

findFieldMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected