/** * Returns the {@link Type} object that represents {@code clazz<T1,T2,T3>}. */ public Type createParameterizedType(Class rawType, Type... arguments) { return new ParameterizedTypeImpl(rawType, arguments, null); }
/** * Gets the name of the package that this registry governs. */ public String getPackageName() { return nav.getPackageName(registryClass); }
public Location getLocation() { return nav.getMethodLocation(method); } }
public Adapter(ClassDeclT adapterType,Navigator<TypeT,ClassDeclT,?,?> nav) { this.adapterType = adapterType; TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class)); // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter. assert baseClass!=null; if(nav.isParameterizedType(baseClass)) defaultType = nav.getTypeArgument(baseClass,0); else defaultType = nav.ref(Object.class); if(nav.isParameterizedType(baseClass)) customType = nav.getTypeArgument(baseClass,1); else customType = nav.ref(Object.class); } }
public Location getLocation() { return nav.getClassLocation(nav.asDecl(Object.class)); }
/** * Replaces the type variables in {@code t} by its actual arguments. * * @param decl * provides a list of type variables. See {@link GenericDeclaration#getTypeParameters()} * @param args * actual arguments. See {@link ParameterizedType#getActualTypeArguments()} */ private Type bind(Type t, GenericDeclaration decl, ParameterizedType args) { return binder.visit(t, new BinderArg(decl, args.getActualTypeArguments())); } };
public Type onGenericArray(GenericArrayType g, BinderArg types) { Type c = visit(g.getGenericComponentType(), types); if (c == g.getGenericComponentType()) { return g; } return new GenericArrayTypeImpl(c); }
public TypeT getRawType() { if(getter!=null) return parent.nav().getReturnType(getter); else return parent.nav().getMethodParameters(setter)[0]; }
public Adapter( XmlJavaTypeAdapter spec, AnnotationReader<TypeT,ClassDeclT,?,?> reader, Navigator<TypeT,ClassDeclT,?,?> nav) { this( nav.asDecl(reader.getClassValue(spec,"value")), nav ); }
public AnyTypeImpl(Navigator<T,C,?,?> nav) { this.type = nav.ref(Object.class); this.nav = nav; }
public Type getBaseClass(Type t, Class sup) { return baseClassFinder.visit(t, sup); }
public Class asDecl(Type t) { return erasure(t); }
public Type onVariable(TypeVariable v, BinderArg types) { return types.replace(v); }
ParameterizedTypeImpl(Class<?> rawType, Type[] actualTypeArguments, Type ownerType) { this.actualTypeArguments = actualTypeArguments; this.rawType = rawType; if (ownerType != null) { this.ownerType = ownerType; } else { this.ownerType = rawType.getDeclaringClass(); } validateConstructorArguments(); }
public final <T> Accessor<BeanT, T> adapt(Adapter<Type, Class> adapter) { return new AdaptedAccessor<BeanT, ValueT, T>( (Class<T>) Utils.REFLECTION_NAVIGATOR.erasure(adapter.defaultType), this, adapter.adapterType); }
public Location getLocation() { return nav.getClassLocation(registryClass); }
public Location getLocation() { return nav.getFieldLocation(field); } }
/** * Returns the runtime representation of the given type. * * This corresponds to the notion of the erasure in JSR-14. * * <p> * Because of the difference in the way Annotation Processing and the Java reflection * treats primitive type and array type, we can't define this method * on {@link Navigator}. * * <p> * It made me realize how difficult it is to define the common navigation * layer for two different underlying reflection library. The other way * is to throw away the entire parameterization and go to the wrapper approach. */ public <T> Class<T> erasure(Type t) { return eraser.visit(t, null); }
public Location getLocation() { if(getter!=null) return parent.nav().getMethodLocation(getter); else return parent.nav().getMethodLocation(setter); } }
public Location getLocation() { return nav.getClassLocation(clazz); } }