superType = superType.getSuperType(); Class<?> raw = superType.getRawClass(); TypeBindings newBindings = new TypeBindings(this, raw); if (superType.isGeneric()) { // got bindings, need to resolve ParameterizedType pt = superType.asGeneric(); String name = vars[i].getName(); JavaType type = instance._constructType(actualTypes[i], bindings); newBindings.addBinding(name, type); return null; return bindings.typesAsArray();
protected JavaType getType(TypeBindings bindings, TypeVariable<?>[] typeParams) { // [JACKSON-468] Need to consider local type binding declarations too... if (typeParams != null && typeParams.length > 0) { bindings = bindings.childInstance(); for (TypeVariable<?> var : typeParams) { String name = var.getName(); // to prevent infinite loops, need to first add placeholder ("<T extends Enum<T>>" etc) bindings._addPlaceholder(name); // About only useful piece of information is the lower bound (which is at least Object.class) Type lowerBound = var.getBounds()[0]; JavaType type = (lowerBound == null) ? TypeFactory.unknownType() : bindings.resolveType(lowerBound); bindings.addBinding(var.getName(), type); } } return bindings.resolveType(getGenericType()); }
JavaType actualType = context.findType(name); if (actualType != null) { return actualType; context._addPlaceholder(name); return _constructType(bounds[0], context);
/** * Constructor used to create "child" instances; mostly to * allow delegation from explicitly defined local overrides * (local type variables for methods, constructors) to * contextual (class-defined) ones. * * @since 1.7 */ public TypeBindings childInstance() { return new TypeBindings(_typeFactory, this, _contextClass, _contextType); }
/** * Method called to fully resolve type of one of parameters, given * specified type variable bindings. * * @since 1.8 */ public final JavaType resolveParameterType(int index, TypeBindings bindings) { return bindings.resolveType(getParameterType(index)); }
_addPlaceholder(name); _resolveBindings(raw.getDeclaringClass()); if (_bindings.containsKey(name)) continue; _addPlaceholder(name); // to prevent infinite loops _resolveBindings(raw.getGenericSuperclass()); for (Type intType : raw.getGenericInterfaces()) { _resolveBindings(intType);
/** * @since 1.8 */ /* public TypeFactory getTypeFactory() { return _typeFactory; } */ public int getBindingCount() { if (_bindings == null) { _resolve(); } return _bindings.size(); }
protected void _resolve() { _resolveBindings(_contextClass); // finally: may have root level type info too if (_contextType != null) { int count = _contextType.containedTypeCount(); if (count > 0) { if (_bindings == null) { _bindings = new LinkedHashMap<String,JavaType>(); } for (int i = 0; i < count; ++i) { String name = _contextType.containedTypeName(i); JavaType type = _contextType.containedType(i); _bindings.put(name, type); } } } // nothing bound? mark with empty map to prevent further calls if (_bindings == null) { _bindings = Collections.emptyMap(); } }
@Override public TypeBindings bindingsForBeanType() { if (_bindings == null) { _bindings = new TypeBindings(_config.getTypeFactory(), _type); } return _bindings; }
/** * Full generic type of the annotated element; definition * of what exactly this means depends on sub-class. */ public JavaType getType(TypeBindings context) { return context.resolveType(getGenericType()); }
JavaType actualType = context.findType(name); if (actualType != null) { return actualType; context._addPlaceholder(name); return _constructType(bounds[0], context);
_addPlaceholder(name); _resolveBindings(raw.getDeclaringClass()); if (_bindings.containsKey(name)) continue; _addPlaceholder(name); // to prevent infinite loops _resolveBindings(raw.getGenericSuperclass()); for (Type intType : raw.getGenericInterfaces()) { _resolveBindings(intType);
public JavaType[] typesAsArray() { if (_bindings == null) { _resolve(); } if (_bindings.size() == 0) { return NO_TYPES; } return _bindings.values().toArray(new JavaType[_bindings.size()]); }
protected void _resolve() { _resolveBindings(_contextClass); // finally: may have root level type info too if (_contextType != null) { int count = _contextType.containedTypeCount(); if (count > 0) { if (_bindings == null) { _bindings = new LinkedHashMap<String,JavaType>(); } for (int i = 0; i < count; ++i) { String name = _contextType.containedTypeName(i); JavaType type = _contextType.containedType(i); _bindings.put(name, type); } } } // nothing bound? mark with empty map to prevent further calls if (_bindings == null) { _bindings = Collections.emptyMap(); } }
protected JavaType getType(TypeBindings bindings, TypeVariable<?>[] typeParams) { // [JACKSON-468] Need to consider local type binding declarations too... if (typeParams != null && typeParams.length > 0) { bindings = bindings.childInstance(); for (TypeVariable<?> var : typeParams) { String name = var.getName(); // to prevent infinite loops, need to first add placeholder ("<T extends Enum<T>>" etc) bindings._addPlaceholder(name); // About only useful piece of information is the lower bound (which is at least Object.class) Type lowerBound = var.getBounds()[0]; JavaType type = (lowerBound == null) ? TypeFactory.unknownType() : bindings.resolveType(lowerBound); bindings.addBinding(var.getName(), type); } } return bindings.resolveType(getGenericType()); }
superType = superType.getSuperType(); Class<?> raw = superType.getRawClass(); TypeBindings newBindings = new TypeBindings(this, raw); if (superType.isGeneric()) { // got bindings, need to resolve ParameterizedType pt = superType.asGeneric(); String name = vars[i].getName(); JavaType type = instance._constructType(actualTypes[i], bindings); newBindings.addBinding(name, type); return null; return bindings.typesAsArray();
public JavaType constructType(Type type, JavaType context) { TypeBindings b = (context == null) ? null : new TypeBindings(this, context); return _constructType(type, b); }
@Override public JavaType resolveType(java.lang.reflect.Type jdkType) { if (jdkType == null) { return null; } return bindingsForBeanType().resolveType(jdkType); }
JavaType actualType = context.findType(name); if (actualType != null) { return actualType; context._addPlaceholder(name); return _constructType(bounds[0], context);