@Test public void shouldRecognizeCorrectTypesFromFields() throws NoSuchFieldException { assertEquals(boolean.class, MemberUtil.getCorrectType(getDeclaredField("boolField"))); assertEquals(boolean.class, MemberUtil.getCorrectType(getDeclaredField("boolField2"))); assertEquals(Boolean.class, MemberUtil.getCorrectType(getDeclaredField("bigBoolField"))); assertEquals(Boolean.class, MemberUtil.getCorrectType(getDeclaredField("bigBoolField2"))); assertEquals(int.class, MemberUtil.getCorrectType(getDeclaredField("intField"))); assertEquals(Integer.class, MemberUtil.getCorrectType(getDeclaredField("bigIntField"))); assertEquals(String.class, MemberUtil.getCorrectType(getDeclaredField("strField"))); }
public static Class<?> getCorrectType(AnnotatedElement object) { return object instanceof Member ? getCorrectType((Member) object) : null; }
MemberUtil { public static Class<?> getCorrectType(AnnotatedElement object) { return object instanceof Member ? getCorrectType((Member) object) : null; } }
MemberUtil { public static Class<?> getCorrectType(AnnotatedElement object) { return object instanceof Member ? getCorrectType((Member) object) : null; } private  MemberUtil(); }
MemberUtil { public static Class<?> getCorrectType(AnnotatedElement object) { return object instanceof Member ? getCorrectType((Member) object) : null; } private  MemberUtil(); static List<Member> getMembers(Class<?> clazz, Predicate memberPredicate); static String getFieldName(AnnotatedElement object); static String getFieldName(Member object); static String getDefaultEnumName(String entityClassName, String fieldName); static Class<?> getCorrectType(AnnotatedElement object); static Class<?> getCorrectType(Member object); static Class<?> getGenericType(AnnotatedElement object); static Class<?> getGenericType(AnnotatedElement object, int typeNumber); static Class<?> getGenericType(Member object, int typeNumber); static String getGetterName(String fieldName, CtClass declaring); static String getSetterName(String fieldName); static boolean isGetter(Member member); static boolean isSetter(Member member); static String getFieldNameFromGetterSetterName(String getterSetterName); static Class<?> getDeclaringClass(AccessibleObject ac); static List<AccessibleObject> getFieldAndAccessorsForElement(AccessibleObject ao); }
MemberUtil { public static Class<?> getCorrectType(AnnotatedElement object) { return object instanceof Member ? getCorrectType((Member) object) : null; } private  MemberUtil(); static List<Member> getMembers(Class<?> clazz, Predicate memberPredicate); static String getFieldName(AnnotatedElement object); static String getFieldName(Member object); static String getDefaultEnumName(String entityClassName, String fieldName); static Class<?> getCorrectType(AnnotatedElement object); static Class<?> getCorrectType(Member object); static Class<?> getGenericType(AnnotatedElement object); static Class<?> getGenericType(AnnotatedElement object, int typeNumber); static Class<?> getGenericType(Member object, int typeNumber); static String getGetterName(String fieldName, CtClass declaring); static String getSetterName(String fieldName); static boolean isGetter(Member member); static boolean isSetter(Member member); static String getFieldNameFromGetterSetterName(String getterSetterName); static Class<?> getDeclaringClass(AccessibleObject ac); static List<AccessibleObject> getFieldAndAccessorsForElement(AccessibleObject ao); static final String GETTER_PREFIX; static final String BOOLEAN_GETTER_PREFIX; static final String SETTER_PREFIX; static final int GET_OR_SET_END_INDEX; static final int IS_END_INDEX; }