/** * Format a {@link Class} as a {@link String}. * @param c {@code Class} to format * @return String */ private static String classToString(final Class<?> c) { final StringBuilder buf = new StringBuilder(); if (c.getEnclosingClass() != null) { buf.append(classToString(c.getEnclosingClass())).append('.').append(c.getSimpleName()); } else { buf.append(c.getName()); } if (c.getTypeParameters().length > 0) { buf.append('<'); appendAllTo(buf, ", ", c.getTypeParameters()); buf.append('>'); } return buf.toString(); }
/** * Format a {@link Class} as a {@link String}. * @param c {@code Class} to format * @return String */ private static String classToString(final Class<?> c) { final StringBuilder buf = new StringBuilder(); if (c.getEnclosingClass() != null) { buf.append(classToString(c.getEnclosingClass())).append('.').append(c.getSimpleName()); } else { buf.append(c.getName()); } if (c.getTypeParameters().length > 0) { buf.append('<'); appendAllTo(buf, ", ", c.getTypeParameters()); buf.append('>'); } return buf.toString(); }
/** * Format a {@link Class} as a {@link String}. * @param c {@code Class} to format * @return String */ private static String classToString(final Class<?> c) { final StringBuilder buf = new StringBuilder(); if (c.getEnclosingClass() != null) { buf.append(classToString(c.getEnclosingClass())).append('.').append(c.getSimpleName()); } else { buf.append(c.getName()); } if (c.getTypeParameters().length > 0) { buf.append('<'); appendAllTo(buf, ", ", c.getTypeParameters()); buf.append('>'); } return buf.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 */ 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(type.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 */ 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(type.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 */ 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(type.toString()); }