public JavaType constructType(Type type, TypeBindings bindings) { return _constructType(type, bindings); }
public JavaType constructType(Type type) { return _constructType(type, null); }
public JavaType resolveType(Class<?> cls) { return _typeFactory._constructType(cls, this); }
public JavaType resolveType(Type type) { return _typeFactory._constructType(type, this); }
protected JavaType _fromWildcard(WildcardType type, TypeBindings context) { /* Similar to challenges with TypeVariable, we may have * multiple upper bounds. But it is also possible that if * upper bound defaults to Object, we might want to consider * lower bounds instead. * * For now, we won't try anything more advanced; above is * just for future reference. */ return _constructType(type.getUpperBounds()[0], context); }
/** * Factory method that can be used if type information is passed * as Java typing returned from <code>getGenericXxx</code> methods * (usually for a return or argument type). * * @deprecated Use {@link #type(Type)} instead */ @Deprecated public static JavaType fromType(Type type) { return instance._constructType(type, null); }
@Deprecated public static JavaType type(Type t) { return instance._constructType(t, null); }
@Deprecated public static JavaType type(Type type, TypeBindings bindings) { return instance._constructType(type, bindings); }
/** * Method for constructing an {@link ArrayType}. *<p> * NOTE: type modifiers are NOT called on array type itself; but are called * for element type (and other contained types) */ public ArrayType constructArrayType(Class<?> elementType) { return ArrayType.construct(_constructType(elementType, null), null, null); }
protected JavaType _fromArrayType(GenericArrayType type, TypeBindings context) { JavaType compType = _constructType(type.getGenericComponentType(), context); return ArrayType.construct(compType, null, null); }
public JavaType constructType(Type type, JavaType context) { TypeBindings b = (context == null) ? null : new TypeBindings(this, context); return _constructType(type, b); }
public JavaType constructType(Type type, Class<?> context) { TypeBindings b = (context == null) ? null : new TypeBindings(this, context); return _constructType(type, b); }
public JavaType constructType(TypeReference<?> typeRef) { return _constructType(typeRef.getType(), null); }
protected JavaType _resolveVariableViaSubTypes(HierarchicType leafType, String variableName, TypeBindings bindings) { // can't resolve raw types; possible to have as-of-yet-unbound types too: if (leafType != null && leafType.isGeneric()) { TypeVariable<?>[] typeVariables = leafType.getRawClass().getTypeParameters(); for (int i = 0, len = typeVariables.length; i < len; ++i) { TypeVariable<?> tv = typeVariables[i]; if (variableName.equals(tv.getName())) { // further resolution needed? Type type = leafType.asGeneric().getActualTypeArguments()[i]; if (type instanceof TypeVariable<?>) { return _resolveVariableViaSubTypes(leafType.getSubType(), ((TypeVariable<?>) type).getName(), bindings); } // no we're good for the variable (but it may have parameterization of its own) return _constructType(type, bindings); } } } return _unknownType(); }
/** * @param context Mapping of formal parameter declarations (for generic * types) into actual types */ protected JavaType _fromClass(Class<?> clz, TypeBindings context) { // First: do we have an array type? if (clz.isArray()) { return ArrayType.construct(_constructType(clz.getComponentType(), null), null, null); } /* Also: although enums can also be fully resolved, there's little * point in doing so (T extends Enum<T>) etc. */ if (clz.isEnum()) { return new SimpleType(clz); } /* Maps and Collections aren't quite as hot; problem is, due * to type erasure we often do not know typing and can only assume * base Object. */ if (Map.class.isAssignableFrom(clz)) { return _mapType(clz); } if (Collection.class.isAssignableFrom(clz)) { return _collectionType(clz); } return new SimpleType(clz); }
_bindings.put(name, _typeFactory._constructType(args[i], this)); _bindings.put(name, typeParams[i]); } else { _bindings.put(name, _typeFactory._constructType(varType, this));
return _constructType(bounds[0], context);
return ArrayType.construct(_constructType(clz.getComponentType(), null), null, null);
pt = new JavaType[paramCount]; for (int i = 0; i < paramCount; ++i) { pt[i] = _constructType(args[i], context);
for (int i = 0; i < len; ++i) { String name = vars[i].getName(); JavaType type = instance._constructType(actualTypes[i], bindings); newBindings.addBinding(name, type);