/** * Check whether the given class matches the user-specified type name. * * @param clazz the class to check * @param typeName the type name to match */ public static boolean matchesTypeName(Class<?> clazz, String typeName) { return (typeName != null && (typeName.equals(clazz.getName()) || typeName.equals(clazz.getSimpleName()) || (clazz.isArray() && typeName.equals(getQualifiedNameForArray(clazz))))); }
/** * Check whether the given class matches the user-specified type name. * @param clazz the class to check * @param typeName the type name to match */ public static boolean matchesTypeName(Class<?> clazz, String typeName) { return (typeName != null && (typeName.equals(clazz.getName()) || typeName.equals(clazz.getSimpleName()) || (clazz.isArray() && typeName.equals(getQualifiedNameForArray(clazz))))); }
/** * Check whether the given class matches the user-specified type name. * * @param clazz the class to check * @param typeName the type name to match */ public static boolean matchesTypeName(Class<?> clazz, String typeName) { return (typeName != null && (typeName.equals(clazz.getName()) || typeName.equals(clazz.getSimpleName()) || (clazz.isArray() && typeName.equals(getQualifiedNameForArray(clazz))))); }
/** * Return the qualified name of the given class: usually simply * the class name, but component type class name + "[]" for arrays. * * @param clazz the class * @return the qualified name of the class */ public static String getQualifiedName(Class<?> clazz) { Assert.notNull(clazz, "Class must not be null"); if (clazz.isArray()) { return getQualifiedNameForArray(clazz); } else { return clazz.getName(); } }
/** * Return the qualified name of the given class: usually simply * the class name, but component type class name + "[]" for arrays. * * @param clazz the class * @return the qualified name of the class */ public static String getQualifiedName(Class<?> clazz) { Assert.notNull(clazz, "Class must not be null"); if (clazz.isArray()) { return getQualifiedNameForArray(clazz); } else { return clazz.getName(); } }
/** * Return the qualified name of the given class: usually simply * the class name, but component type class name + "[]" for arrays. * @param clazz the class * @return the qualified name of the class */ public static String getQualifiedName(Class<?> clazz) { Assert.notNull(clazz, "Class must not be null"); if (clazz.isArray()) { return getQualifiedNameForArray(clazz); } else { return clazz.getName(); } }
/** * Return a descriptive name for the given object's type: usually simply * the class name, but component type class name + "[]" for arrays, * and an appended list of implemented interfaces for JDK proxies. * * @param value the value to introspect * @return the qualified name of the class */ public static String getDescriptiveType(Object value) { if (value == null) { return null; } Class<?> clazz = value.getClass(); if (Proxy.isProxyClass(clazz)) { StringBuilder result = new StringBuilder(clazz.getName()); result.append(" implementing "); Class<?>[] ifcs = clazz.getInterfaces(); for (int i = 0; i < ifcs.length; i++) { result.append(ifcs[i].getName()); if (i < ifcs.length - 1) { result.append(','); } } return result.toString(); } else if (clazz.isArray()) { return getQualifiedNameForArray(clazz); } else { return clazz.getName(); } }
/** * Return a descriptive name for the given object's type: usually simply * the class name, but component type class name + "[]" for arrays, * and an appended list of implemented interfaces for JDK proxies. * * @param value the value to introspect * @return the qualified name of the class */ public static String getDescriptiveType(Object value) { if (value == null) { return null; } Class<?> clazz = value.getClass(); if (Proxy.isProxyClass(clazz)) { StringBuilder result = new StringBuilder(clazz.getName()); result.append(" implementing "); Class<?>[] ifcs = clazz.getInterfaces(); for (int i = 0; i < ifcs.length; i++) { result.append(ifcs[i].getName()); if (i < ifcs.length - 1) { result.append(','); } } return result.toString(); } else if (clazz.isArray()) { return getQualifiedNameForArray(clazz); } else { return clazz.getName(); } }