diff --git a/src/main/java/me/mrnavastar/r/R.java b/src/main/java/me/mrnavastar/r/R.java index a209ff2..1642e85 100644 --- a/src/main/java/me/mrnavastar/r/R.java +++ b/src/main/java/me/mrnavastar/r/R.java @@ -36,8 +36,12 @@ public static R of(Class clazz) { /** * Create an instance of {@link R} from a field in another {@link R} instance */ - public R of(String name, Class type) { - return R.of(get(name, type)); + public R of(String name) { + try { + return R.of(findField(name, clazz).get(instance)); + } catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } } // Search super classes for field