Exemple #1
0
 public static String describe(Type t) {
   if (t instanceof Class<?>) {
     return Descriptor.of(((Class) t).getName());
   } else if (t instanceof ParameterizedType) {
     ParameterizedType pType = ((ParameterizedType) t);
     Type[] args = pType.getActualTypeArguments();
     StringBuilder formatted = new StringBuilder();
     for (Type type : args) {
       formatted.append(describe(type));
     }
     return parameterized((Class) pType.getRawType()).ofFormatted(formatted.toString()).build();
   }
   return "";
 }
Exemple #2
0
 public static ClassNameBuilder parameterized(Class<?> clazz) {
   return new ClassNameBuilder(Descriptor.of(clazz.getName()));
 }
Exemple #3
0
 ClassNameBuilder of(Class<?> clazz) {
   return new ClassNameBuilder(prune(this.name) + "<" + Descriptor.of(clazz.getName()) + ">;");
 }