@Test public void testIsBeanType() { isTrue(Cls.isBeanType(Foo.class)); isFalse(Cls.isBeanType(Object.class)); isFalse(Cls.isBeanType(HttpVerb.class)); isFalse(Cls.isBeanType(Runnable.class)); isFalse(Cls.isBeanType(ArrayList.class)); isFalse(Cls.isBeanType(HashSet.class)); isFalse(Cls.isBeanType(HashMap.class)); }
public static boolean isBeanType(Class<?> clazz) { return clazz != null && clazz != Object.class && kindOf(clazz) == TypeKind.UNKNOWN && (!clazz.getName().startsWith("java.") || clazz.getName().startsWith("java.lang.management.")) && (!clazz.getName().startsWith("javax.") || clazz.getName().startsWith("javax.management.")) && !clazz.isAnnotation() && !clazz.isEnum() && !clazz.isInterface() && !(Collection.class.isAssignableFrom(clazz)) && !(Map.class.isAssignableFrom(clazz)) && !(Object[].class.isAssignableFrom(clazz)); }
Cls extends RapidoidThing { public static boolean isBeanType(Class<?> clazz) { return clazz != null && clazz != Object.class && kindOf(clazz) == TypeKind.UNKNOWN && (!clazz.getName().startsWith("java.") || clazz.getName().startsWith("java.lang.management.")) && (!clazz.getName().startsWith("javax.") || clazz.getName().startsWith("javax.management.")) && !clazz.isAnnotation() && !clazz.isEnum() && !clazz.isInterface() && !(Collection.class.isAssignableFrom(clazz)) && !(Map.class.isAssignableFrom(clazz)) && !(Object[].class.isAssignableFrom(clazz)); } }
Cls extends RapidoidThing { public static boolean isBeanType(Class<?> clazz) { return clazz != null && clazz != Object.class && kindOf(clazz) == TypeKind.UNKNOWN && (!clazz.getName().startsWith("java.") || clazz.getName().startsWith("java.lang.management.")) && (!clazz.getName().startsWith("javax.") || clazz.getName().startsWith("javax.management.")) && !clazz.isAnnotation() && !clazz.isEnum() && !clazz.isInterface() && !(Collection.class.isAssignableFrom(clazz)) && !(Map.class.isAssignableFrom(clazz)) && !(Object[].class.isAssignableFrom(clazz)); }  }
Cls extends RapidoidThing { public static boolean isBeanType(Class<?> clazz) { return clazz != null && clazz != Object.class && kindOf(clazz) == TypeKind.UNKNOWN && (!clazz.getName().startsWith("java.") || clazz.getName().startsWith("java.lang.management.")) && (!clazz.getName().startsWith("javax.") || clazz.getName().startsWith("javax.management.")) && !clazz.isAnnotation() && !clazz.isEnum() && !clazz.isInterface() && !(Collection.class.isAssignableFrom(clazz)) && !(Map.class.isAssignableFrom(clazz)) && !(Object[].class.isAssignableFrom(clazz)); }  static TypeKind kindOf(Class<?> type); static TypeKind kindOf(Object value); @SuppressWarnings("unchecked") static T getFieldValue(Object instance, String fieldName, T defaultValue); static Object getFieldValue(Object instance, String fieldName); static Object getFieldValue(Field field, Object instance); static List<Annotation> getAnnotations(Class<?> clazz); static List<Method> getMethods(Class<?> clazz); static List<Method> getMethodsNamed(Class<?> clazz, String name); static Method getMethod(Class<?> clazz, String name, Class<?>... parameterTypes); static Method findMethod(Class<?> clazz, String name, Class<?>... parameterTypes); static Field findField(Class<?> clazz, String name); @SuppressWarnings("unchecked") static T invokeStatic(Method m, Object... args); @SuppressWarnings("unchecked") static T invoke(Method m, Object target, Object... args); @SuppressWarnings("unchecked") static T invoke(Constructor<?> constructor, Object... args); @SuppressWarnings("unchecked") static T invokeRethrowing(Method method, Object target, Object... args); static Class<?>[] getImplementedInterfaces(Class<?> clazz); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz, Map<String, Object> properties); static Object[] getAssignableArgs(Class<?>[] types, Collection<?> properties); @SuppressWarnings("unchecked") static T getUniqueInstanceOf(Class<T> type, Collection<?> values); static ClassLoader classLoader(); @SuppressWarnings("unchecked") static T convert(String value, Class<T> toType); @SuppressWarnings("unchecked") static T convert(Object value, Class<T> toType); static Method findMethodByArgs(Class<? extends Object> clazz, String name, Object... args); @SuppressWarnings("unchecked") static Class<T> clazz(Type type); @SuppressWarnings("unchecked") static Class<T> of(T obj); static String str(Object value); static boolean bool(Object value); static ParameterizedType generic(Type type); static boolean isJREClass(String className); static boolean isJREType(Class<?> type); @SuppressWarnings("unchecked") static Class<T> getWrapperClass(Class<T> c); static boolean instanceOf(Object obj, Class<?>... classes); static boolean isAssignableTo(Class<?> clazz, Class<?>... targetClasses); static boolean areAssignable(Class<?>[] types, Object[] values); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz); static T newBeanInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz, Object... args); static T customizable(Class<T> clazz, Object... args); @SuppressWarnings("unchecked") static Class<T> getClassIfExists(String className); static Class<T> get(String className); static Class<?> unproxy(Class<?> cls); static boolean isSimple(Object target); static boolean isNumber(Object target); static boolean isDataStructure(Class<?> clazz); static boolean isBeanType(Class<?> clazz); static boolean isAppBeanType(Class<?> clazz); static boolean isBean(Object target); static boolean isAppBean(Object target); static T struct(Class<T> clazz1, Class<T2> clazz2, Object obj); static boolean exists(String className); static Class<?> toClass(Object classOrInstance); static boolean isAnnotated(Class<?> type, Class<? extends Annotation> annotation); }
Cls extends RapidoidThing { public static boolean isBeanType(Class<?> clazz) { return clazz != null && clazz != Object.class && kindOf(clazz) == TypeKind.UNKNOWN && (!clazz.getName().startsWith("java.") || clazz.getName().startsWith("java.lang.management.")) && (!clazz.getName().startsWith("javax.") || clazz.getName().startsWith("javax.management.")) && !clazz.isAnnotation() && !clazz.isEnum() && !clazz.isInterface() && !(Collection.class.isAssignableFrom(clazz)) && !(Map.class.isAssignableFrom(clazz)) && !(Object[].class.isAssignableFrom(clazz)); }  static TypeKind kindOf(Class<?> type); static TypeKind kindOf(Object value); @SuppressWarnings("unchecked") static T getFieldValue(Object instance, String fieldName, T defaultValue); static Object getFieldValue(Object instance, String fieldName); static Object getFieldValue(Field field, Object instance); static List<Annotation> getAnnotations(Class<?> clazz); static List<Method> getMethods(Class<?> clazz); static List<Method> getMethodsNamed(Class<?> clazz, String name); static Method getMethod(Class<?> clazz, String name, Class<?>... parameterTypes); static Method findMethod(Class<?> clazz, String name, Class<?>... parameterTypes); static Field findField(Class<?> clazz, String name); @SuppressWarnings("unchecked") static T invokeStatic(Method m, Object... args); @SuppressWarnings("unchecked") static T invoke(Method m, Object target, Object... args); @SuppressWarnings("unchecked") static T invoke(Constructor<?> constructor, Object... args); @SuppressWarnings("unchecked") static T invokeRethrowing(Method method, Object target, Object... args); static Class<?>[] getImplementedInterfaces(Class<?> clazz); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz, Map<String, Object> properties); static Object[] getAssignableArgs(Class<?>[] types, Collection<?> properties); @SuppressWarnings("unchecked") static T getUniqueInstanceOf(Class<T> type, Collection<?> values); static ClassLoader classLoader(); @SuppressWarnings("unchecked") static T convert(String value, Class<T> toType); @SuppressWarnings("unchecked") static T convert(Object value, Class<T> toType); static Method findMethodByArgs(Class<? extends Object> clazz, String name, Object... args); @SuppressWarnings("unchecked") static Class<T> clazz(Type type); @SuppressWarnings("unchecked") static Class<T> of(T obj); static String str(Object value); static boolean bool(Object value); static ParameterizedType generic(Type type); static boolean isJREClass(String className); static boolean isJREType(Class<?> type); @SuppressWarnings("unchecked") static Class<T> getWrapperClass(Class<T> c); static boolean instanceOf(Object obj, Class<?>... classes); static boolean isAssignableTo(Class<?> clazz, Class<?>... targetClasses); static boolean areAssignable(Class<?>[] types, Object[] values); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz); static T newBeanInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz, Object... args); static T customizable(Class<T> clazz, Object... args); @SuppressWarnings("unchecked") static Class<T> getClassIfExists(String className); static Class<T> get(String className); static Class<?> unproxy(Class<?> cls); static boolean isSimple(Object target); static boolean isNumber(Object target); static boolean isDataStructure(Class<?> clazz); static boolean isBeanType(Class<?> clazz); static boolean isAppBeanType(Class<?> clazz); static boolean isBean(Object target); static boolean isAppBean(Object target); static T struct(Class<T> clazz1, Class<T2> clazz2, Object obj); static boolean exists(String className); static Class<?> toClass(Object classOrInstance); static boolean isAnnotated(Class<?> type, Class<? extends Annotation> annotation);  }