@Test void normalizesGenericNames() { Assertions.assertAll( () -> assertEquals("String", GeciReflectionTools.normalizeTypeName("java.lang.String")), () -> assertEquals("java.util.Map", GeciReflectionTools.normalizeTypeName("java.util.Map")), () -> assertEquals("java.util.Map<Integer,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.lang.Integer,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set<java.lang.Integer>,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set< java.lang.Integer>,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<com.java.lang.Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set< com. java.lang.Integer>,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<? extends com.java.lang.Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set<? extends com. java.lang.Integer> , java.lang.String>")) ); }
public static String normalizeTypeName(String s) { s = s.replaceAll("\\s*<\\s*", "<") .replaceAll("\\s*>\\s*", ">") .replaceAll("\\s*\\.\\s*", ".") .replaceAll("\\s*,\\s*", ",") .replaceAll("\\s+", " "); if (s.startsWith("java.lang.")) { s = s.substring("java.lang.".length()); } s = s.replaceAll("([^\\w\\d.^])java.lang.", "$1"); s = s.replaceAll("\\$", "."); return s; }
GeciReflectionTools { public static String normalizeTypeName(String s) { s = s.replaceAll("\\s*<\\s*", "<") .replaceAll("\\s*>\\s*", ">") .replaceAll("\\s*\\.\\s*", ".") .replaceAll("\\s*,\\s*", ",") .replaceAll("\\s+", " "); if (s.startsWith("java.lang.")) { s = s.substring("java.lang.".length()); } s = s.replaceAll("([^\\w\\d.^])java.lang.", "$1"); s = s.replaceAll("\\$", "."); return s; } }
GeciReflectionTools { public static String normalizeTypeName(String s) { s = s.replaceAll("\\s*<\\s*", "<") .replaceAll("\\s*>\\s*", ">") .replaceAll("\\s*\\.\\s*", ".") .replaceAll("\\s*,\\s*", ",") .replaceAll("\\s+", " "); if (s.startsWith("java.lang.")) { s = s.substring("java.lang.".length()); } s = s.replaceAll("([^\\w\\d.^])java.lang.", "$1"); s = s.replaceAll("\\$", "."); return s; }  }
GeciReflectionTools { public static String normalizeTypeName(String s) { s = s.replaceAll("\\s*<\\s*", "<") .replaceAll("\\s*>\\s*", ">") .replaceAll("\\s*\\.\\s*", ".") .replaceAll("\\s*,\\s*", ",") .replaceAll("\\s+", " "); if (s.startsWith("java.lang.")) { s = s.substring("java.lang.".length()); } s = s.replaceAll("([^\\w\\d.^])java.lang.", "$1"); s = s.replaceAll("\\$", "."); return s; }  static CompoundParams getParameters(AnnotatedElement element, String generatorMnemonic); static Invoker invoke(String methodName); static String modifiersString(Method method); static String modifiersStringNoAccess(Method method); static String typeAsString(Member member); static String normalizeTypeName(String s); static String normalizeTypeName(String s, Class<?> klass); static String getGenericTypeName(Type t); static String getSimpleGenericClassName(Class<?> t); static String getLocalGenericClassName(Class<?> t); static Field[] getDeclaredFieldsSorted(Class<?> klass); static Field[] getAllFieldsSorted(Class<?> klass); static Method[] getDeclaredMethodsSorted(Class<?> klass); static Method[] getMethodsSorted(Class<?> klass); static Method[] getAllMethodsSorted(final Class<?> klass); static Class[] getAllClassesSorted(Class<?> klass); static Class[] getDeclaredClassesSorted(Class<?> klass); static Class[] getClassesSorted(Class<?> klass); static Method getMethod(Class<?> klass, String methodName, Class<?>... classes); static Field getField(Class<?> klass, String fieldName); static Class<?> classForName(String className); static String unmask(int modifiers); static int mask(String masks, int dfault); }
GeciReflectionTools { public static String normalizeTypeName(String s) { s = s.replaceAll("\\s*<\\s*", "<") .replaceAll("\\s*>\\s*", ">") .replaceAll("\\s*\\.\\s*", ".") .replaceAll("\\s*,\\s*", ",") .replaceAll("\\s+", " "); if (s.startsWith("java.lang.")) { s = s.substring("java.lang.".length()); } s = s.replaceAll("([^\\w\\d.^])java.lang.", "$1"); s = s.replaceAll("\\$", "."); return s; }  static CompoundParams getParameters(AnnotatedElement element, String generatorMnemonic); static Invoker invoke(String methodName); static String modifiersString(Method method); static String modifiersStringNoAccess(Method method); static String typeAsString(Member member); static String normalizeTypeName(String s); static String normalizeTypeName(String s, Class<?> klass); static String getGenericTypeName(Type t); static String getSimpleGenericClassName(Class<?> t); static String getLocalGenericClassName(Class<?> t); static Field[] getDeclaredFieldsSorted(Class<?> klass); static Field[] getAllFieldsSorted(Class<?> klass); static Method[] getDeclaredMethodsSorted(Class<?> klass); static Method[] getMethodsSorted(Class<?> klass); static Method[] getAllMethodsSorted(final Class<?> klass); static Class[] getAllClassesSorted(Class<?> klass); static Class[] getDeclaredClassesSorted(Class<?> klass); static Class[] getClassesSorted(Class<?> klass); static Method getMethod(Class<?> klass, String methodName, Class<?>... classes); static Field getField(Class<?> klass, String fieldName); static Class<?> classForName(String className); static String unmask(int modifiers); static int mask(String masks, int dfault); static final int PACKAGE; }