/** * Format a {@link TypeVariable} including its {@link GenericDeclaration}. * * @param var the type variable to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toLongString(final TypeVariable<?> var) { Validate.notNull(var, "var is null"); final StringBuilder buf = new StringBuilder(); final GenericDeclaration d = var.getGenericDeclaration(); if (d instanceof Class<?>) { Class<?> c = (Class<?>) d; while (true) { if (c.getEnclosingClass() == null) { buf.insert(0, c.getName()); break; } buf.insert(0, c.getSimpleName()).insert(0, '.'); c = c.getEnclosingClass(); } } else if (d instanceof Type) {// not possible as of now buf.append(toString((Type) d)); } else { buf.append(d); } return buf.append(':').append(typeVariableToString(var)).toString(); }
/** * Present a given type as a Java-esque String. * * @param type the type to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toString(final Type type) { Validate.notNull(type); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw new IllegalArgumentException(ObjectUtils.identityToString(type)); }
/** * Format a {@link TypeVariable} including its {@link GenericDeclaration}. * * @param var the type variable to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toLongString(final TypeVariable<?> var) { Validate.notNull(var, "var is null"); final StringBuilder buf = new StringBuilder(); final GenericDeclaration d = var.getGenericDeclaration(); if (d instanceof Class<?>) { Class<?> c = (Class<?>) d; while (true) { if (c.getEnclosingClass() == null) { buf.insert(0, c.getName()); break; } buf.insert(0, c.getSimpleName()).insert(0, '.'); c = c.getEnclosingClass(); } } else if (d instanceof Type) {// not possible as of now buf.append(toString((Type) d)); } else { buf.append(d); } return buf.append(':').append(typeVariableToString(var)).toString(); }
/** * Format a {@link TypeVariable} including its {@link GenericDeclaration}. * * @param var the type variable to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toLongString(final TypeVariable<?> var) { Validate.notNull(var, "var is null"); final StringBuilder buf = new StringBuilder(); final GenericDeclaration d = var.getGenericDeclaration(); if (d instanceof Class<?>) { Class<?> c = (Class<?>) d; while (true) { if (c.getEnclosingClass() == null) { buf.insert(0, c.getName()); break; } buf.insert(0, c.getSimpleName()).insert(0, '.'); c = c.getEnclosingClass(); } } else if (d instanceof Type) {// not possible as of now buf.append(toString((Type) d)); } else { buf.append(d); } return buf.append(':').append(typeVariableToString(var)).toString(); }
/** * Format a {@link TypeVariable} including its {@link GenericDeclaration}. * * @param var the type variable to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toLongString(final TypeVariable<?> var) { Validate.notNull(var, "var is null"); final StringBuilder buf = new StringBuilder(); final GenericDeclaration d = var.getGenericDeclaration(); if (d instanceof Class<?>) { Class<?> c = (Class<?>) d; while (true) { if (c.getEnclosingClass() == null) { buf.insert(0, c.getName()); break; } buf.insert(0, c.getSimpleName()).insert(0, '.'); c = c.getEnclosingClass(); } } else if (d instanceof Type) {// not possible as of now buf.append(toString((Type) d)); } else { buf.append(d); } return buf.append(':').append(typeVariableToString(var)).toString(); }
/** * Present a given type as a Java-esque String. * * @param type the type to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toString(final Type type) { Validate.notNull(type); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw new IllegalArgumentException(ObjectUtils.identityToString(type)); }
/** * Present a given type as a Java-esque String. * * @param type the type to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toString(final Type type) { Validate.notNull(type); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw new IllegalArgumentException(ObjectUtils.identityToString(type)); }
/** * Present a given type as a Java-esque String. * * @param type the type to create a String representation for, not {@code null} * @return String * @since 3.2 */ public static String toString(final Type type) { Validate.notNull(type); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw new IllegalArgumentException(ObjectUtils.identityToString(type)); }