/** * Method for creating an instance that has same bindings as this object, * plus an indicator for additional type variable that may be unbound within * this context; this is needed to resolve recursive self-references. */ public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
public static TypeBindings create(Class<?> erasedType, JavaType typeArg1, JavaType typeArg2) { // 30-Oct-2015, tatu: Minor optimization for relatively common cases TypeVariable<?>[] vars = TypeParamStash.paramsFor2(erasedType); int varLen = (vars == null) ? 0 : vars.length; if (varLen != 2) { throw new IllegalArgumentException("Cannot create TypeBindings for class "+erasedType.getName() +" with 2 type parameters: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName(), vars[1].getName() }, new JavaType[] { typeArg1, typeArg2 }, null); }
public static TypeBindings create(Class<?> erasedType, JavaType typeArg1) { // 30-Oct-2015, tatu: Minor optimization for relatively common cases TypeVariable<?>[] vars = TypeParamStash.paramsFor1(erasedType); int varLen = (vars == null) ? 0 : vars.length; if (varLen != 1) { throw new IllegalArgumentException("Cannot create TypeBindings for class "+erasedType.getName() +" with 1 type parameter: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName() }, new JavaType[] { typeArg1 }, null); }
/** * Alternate factory method that may be called if it is possible that type * does or does not require type parameters; this is mostly useful for * collection- and map-like types. */ public static TypeBindings createIfNeeded(Class<?> erasedType, JavaType typeArg1) { TypeVariable<?>[] vars = erasedType.getTypeParameters(); int varLen = (vars == null) ? 0 : vars.length; if (varLen == 0) { return EMPTY; } if (varLen != 1) { throw new IllegalArgumentException("Cannot create TypeBindings for class "+erasedType.getName() +" with 1 type parameter: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName() }, new JavaType[] { typeArg1 }, null); }
/** * Alternate factory method that may be called if it is possible that type * does or does not require type parameters; this is mostly useful for * collection- and map-like types. */ public static TypeBindings createIfNeeded(Class<?> erasedType, JavaType[] types) { TypeVariable<?>[] vars = erasedType.getTypeParameters(); if (vars == null || vars.length == 0) { return EMPTY; } if (types == null) { types = NO_TYPES; } int len = vars.length; String[] names = new String[len]; for (int i = 0; i < len; ++i) { names[i] = vars[i].getName(); } // Check here to give better error message if (names.length != types.length) { throw new IllegalArgumentException("Cannot create TypeBindings for class "+erasedType.getName() +" with "+types.length+" type parameter" +((types.length == 1) ? "" : "s")+": class expects "+names.length); } return new TypeBindings(names, types, null); }
public static TypeBindings create(Class<?> erasedType, JavaType[] types) { if (types == null) { types = NO_TYPES; } else switch (types.length) { case 1: return create(erasedType, types[0]); case 2: return create(erasedType, types[0], types[1]); } TypeVariable<?>[] vars = erasedType.getTypeParameters(); String[] names; if (vars == null || vars.length == 0) { names = NO_STRINGS; } else { int len = vars.length; names = new String[len]; for (int i = 0; i < len; ++i) { names[i] = vars[i].getName(); } } // Check here to give better error message if (names.length != types.length) { throw new IllegalArgumentException("Cannot create TypeBindings for class "+erasedType.getName() +" with "+types.length+" type parameter" +((types.length == 1) ? "" : "s")+": class expects "+names.length); } return new TypeBindings(names, types, null); }
/** * 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. */ public TypeBindings childInstance() { return new TypeBindings(_typeFactory, this, _contextClass, _contextType); }
/** * 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. */ public TypeBindings childInstance() { return new TypeBindings(_typeFactory, this, _contextClass, _contextType); }
/** * 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. */ public TypeBindings childInstance() { return new TypeBindings(_typeFactory, this, _contextClass, _contextType); }
/** * 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. */ public TypeBindings childInstance() { return new TypeBindings(_typeFactory, this, _contextClass, _contextType); }
/** * Method for creating an instance that has same bindings as this object, * plus an indicator for additional type variable that may be unbound within * this context; this is needed to resolve recursive self-references. */ public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
/** * Method for creating an instance that has same bindings as this object, * plus an indicator for additional type variable that may be unbound within * this context; this is needed to resolve recursive self-references. */ public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
@Override public TypeBindings bindingsForBeanType() { if (_bindings == null) { _bindings = new TypeBindings(_config.getTypeFactory(), _type); } return _bindings; }
@Override public TypeBindings bindingsForBeanType() { if (_bindings == null) { _bindings = new TypeBindings(_config.getTypeFactory(), _type); } return _bindings; }
@Override public TypeBindings bindingsForBeanType() { if (_bindings == null) { _bindings = new TypeBindings(_config.getTypeFactory(), _type); } return _bindings; }
@Override public TypeBindings bindingsForBeanType() { if (_bindings == null) { _bindings = new TypeBindings(_config.getTypeFactory(), _type); } return _bindings; }
public JavaType constructType(Type type, Class<?> context) { TypeBindings b = (context == null) ? null : new TypeBindings(this, context); return _constructType(type, b); }
public static TypeBindings create(Class<?> erasedType, JavaType typeArg1) { // 30-Oct-2015, tatu: Minor optimization for relatively common cases TypeVariable<?>[] vars = TypeParamStash.paramsFor1(erasedType); int varLen = (vars == null) ? 0 : vars.length; if (varLen != 1) { throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName() +" with 1 type parameter: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName() }, new JavaType[] { typeArg1 }, null); }
public JavaType constructType(Type type, Class<?> context) { TypeBindings b = (context == null) ? null : new TypeBindings(this, context); return _constructType(type, b); }
public static TypeBindings create(Class<?> erasedType, JavaType typeArg1, JavaType typeArg2) { // 30-Oct-2015, tatu: Minor optimization for relatively common cases TypeVariable<?>[] vars = TypeParamStash.paramsFor2(erasedType); int varLen = (vars == null) ? 0 : vars.length; if (varLen != 2) { throw new IllegalArgumentException("Cannot create TypeBindings for class "+erasedType.getName() +" with 2 type parameters: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName(), vars[1].getName() }, new JavaType[] { typeArg1, typeArg2 }, null); }