@Test public void nested_parametrized_type_name() { TypeDescriptor type = TYPES.get(new TypeToken<NestedParametrizedType<NestedParametrizedType<String>>>() {}); assertThat(type.toString()).isEqualTo("org.javersion.reflect.TypeDescriptorTest$NestedParametrizedType<org.javersion.reflect.TypeDescriptorTest$NestedParametrizedType<java.lang.String>>"); }
@Override public String toString() { String name = typeToken.toString(); Matcher matcher = DUPLICATE_OWNER_NAME.matcher(name); StringBuffer sb = new StringBuffer(name.length()); while (matcher.find()) { matcher.appendReplacement(sb, quoteReplacement(matcher.group(2))); } matcher.appendTail(sb); return sb.toString(); }
TypeDescriptor implements ElementDescriptor { @Override public String toString() { String name = typeToken.toString(); Matcher matcher = DUPLICATE_OWNER_NAME.matcher(name); StringBuffer sb = new StringBuffer(name.length()); while (matcher.find()) { matcher.appendReplacement(sb, quoteReplacement(matcher.group(2))); } matcher.appendTail(sb); return sb.toString(); } }
TypeDescriptor implements ElementDescriptor { @Override public String toString() { String name = typeToken.toString(); Matcher matcher = DUPLICATE_OWNER_NAME.matcher(name); StringBuffer sb = new StringBuffer(name.length()); while (matcher.find()) { matcher.appendReplacement(sb, quoteReplacement(matcher.group(2))); } matcher.appendTail(sb); return sb.toString(); } TypeDescriptor(TypeDescriptors typeDescriptors, TypeToken<?> typeToken); }
TypeDescriptor implements ElementDescriptor { @Override public String toString() { String name = typeToken.toString(); Matcher matcher = DUPLICATE_OWNER_NAME.matcher(name); StringBuffer sb = new StringBuffer(name.length()); while (matcher.find()) { matcher.appendReplacement(sb, quoteReplacement(matcher.group(2))); } matcher.appendTail(sb); return sb.toString(); } TypeDescriptor(TypeDescriptors typeDescriptors, TypeToken<?> typeToken); List<Annotation> getAnnotations(); A getAnnotation(Class<A> annotationClass); boolean hasAnnotation(Class<A> annotationClass); boolean equalTo(TypeDescriptor type); boolean equalTo(Class<?> type); Map<String, FieldDescriptor> getFields(); String getName(); String getSimpleName(); static String getSimpleName(Class<?> cls); Map<ConstructorSignature, ConstructorDescriptor> getConstructors(); Map<MethodSignature, MethodDescriptor> getMethods(); Map<String, BeanProperty> getProperties(); boolean hasField(String fieldName); FieldDescriptor getField(String name); TypeDescriptor resolveGenericParameter(Class<?> genericClass, int genericParam); Class<?> getRawType(); TypeToken<?> getTypeToken(); boolean isPrimitiveOrWrapper(); boolean isSuperTypeOf(TypeDescriptor type); boolean isSuperTypeOf(Class<?> clazz); boolean isSubTypeOf(TypeDescriptor type); boolean isSubTypeOf(Class<?> clazz); boolean isEnum(); ConstructorDescriptor getDefaultConstructor(); Object newInstance(); TypeDescriptors getTypeDescriptors(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Override String toString(); boolean isAbstract(); boolean isArray(); TypeDescriptor getComponentType(); }
TypeDescriptor implements ElementDescriptor { @Override public String toString() { String name = typeToken.toString(); Matcher matcher = DUPLICATE_OWNER_NAME.matcher(name); StringBuffer sb = new StringBuffer(name.length()); while (matcher.find()) { matcher.appendReplacement(sb, quoteReplacement(matcher.group(2))); } matcher.appendTail(sb); return sb.toString(); } TypeDescriptor(TypeDescriptors typeDescriptors, TypeToken<?> typeToken); List<Annotation> getAnnotations(); A getAnnotation(Class<A> annotationClass); boolean hasAnnotation(Class<A> annotationClass); boolean equalTo(TypeDescriptor type); boolean equalTo(Class<?> type); Map<String, FieldDescriptor> getFields(); String getName(); String getSimpleName(); static String getSimpleName(Class<?> cls); Map<ConstructorSignature, ConstructorDescriptor> getConstructors(); Map<MethodSignature, MethodDescriptor> getMethods(); Map<String, BeanProperty> getProperties(); boolean hasField(String fieldName); FieldDescriptor getField(String name); TypeDescriptor resolveGenericParameter(Class<?> genericClass, int genericParam); Class<?> getRawType(); TypeToken<?> getTypeToken(); boolean isPrimitiveOrWrapper(); boolean isSuperTypeOf(TypeDescriptor type); boolean isSuperTypeOf(Class<?> clazz); boolean isSubTypeOf(TypeDescriptor type); boolean isSubTypeOf(Class<?> clazz); boolean isEnum(); ConstructorDescriptor getDefaultConstructor(); Object newInstance(); TypeDescriptors getTypeDescriptors(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Override String toString(); boolean isAbstract(); boolean isArray(); TypeDescriptor getComponentType(); static final BiMap<Class<?>, Class<?>> WRAPPER_TO_PRIMITIVE; }