/** * Returns an immutable list of the resolved types. */ private List<TypeLiteral<?>> resolveAll(Type[] types) { TypeLiteral<?>[] result = new TypeLiteral<?>[types.length]; for (int t = 0; t < types.length; t++) { result[t] = resolve(types[t]); } return Arrays.asList(result); }
/** * Returns the resolved generic type of {@code field}. * * @param field a field defined by this or any superclass. * @since 2.0 */ public TypeLiteral<?> getFieldType(Field field) { if (!field.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(field + " is not defined by a supertype of " + type); } return resolve(field.getGenericType()); }
/** * Returns the resolved generic return type of {@code method}. * * @param method a method defined by this or any supertype. * @since 2.0 */ public TypeLiteral<?> getReturnType(Method method) { if (!method.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(method + " is not defined by a supertype of " + type); } return resolve(method.getGenericReturnType()); } }
/** * Returns the generic form of {@code supertype}. For example, if this is {@code * ArrayList<String>}, this returns {@code Iterable<String>} given the input {@code * Iterable.class}. * * @param supertype a superclass of, or interface implemented by, this. * @since 2.0 */ public TypeLiteral<?> getSupertype(Class<?> supertype) { if (!supertype.isAssignableFrom(rawType)) { throw new IllegalArgumentException(supertype + " is not a supertype of " + type); } return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype)); }
/** * Returns an immutable list of the resolved types. */ private List<TypeLiteral<?>> resolveAll(Type[] types) { TypeLiteral<?>[] result = new TypeLiteral<?>[types.length]; for (int t = 0; t < types.length; t++) { result[t] = resolve(types[t]); } return Arrays.asList(result); }
/** * Returns an immutable list of the resolved types. */ private List<TypeLiteral<?>> resolveAll(Type[] types) { TypeLiteral<?>[] result = new TypeLiteral<?>[types.length]; for (int t = 0; t < types.length; t++) { result[t] = resolve(types[t]); } return Arrays.asList(result); }
/** * Returns an immutable list of the resolved types. */ private List<TypeLiteral<?>> resolveAll(Type[] types) { TypeLiteral<?>[] result = new TypeLiteral<?>[types.length]; for (int t = 0; t < types.length; t++) { result[t] = resolve(types[t]); } return Arrays.asList(result); }
/** * Returns an immutable list of the resolved types. */ private List<TypeLiteral<?>> resolveAll(Type[] types) { TypeLiteral<?>[] result = new TypeLiteral<?>[types.length]; for (int t = 0; t < types.length; t++) { result[t] = resolve(types[t]); } return Arrays.asList(result); }
/** * Returns the resolved generic type of {@code field}. * * @param field a field defined by this or any superclass. * @since 2.0 */ public TypeLiteral<?> getFieldType(Field field) { if (!field.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(field + " is not defined by a supertype of " + type); } return resolve(field.getGenericType()); }
/** * Returns the resolved generic type of {@code field}. * * @param field a field defined by this or any superclass. * @since 2.0 */ public TypeLiteral<?> getFieldType(Field field) { if (!field.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(field + " is not defined by a supertype of " + type); } return resolve(field.getGenericType()); }
/** * Returns the resolved generic return type of {@code method}. * * @param method a method defined by this or any supertype. * @since 2.0 */ public TypeLiteral<?> getReturnType(Method method) { if (!method.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(method + " is not defined by a supertype of " + type); } return resolve(method.getGenericReturnType()); } }
/** * Returns the resolved generic return type of {@code method}. * * @param method a method defined by this or any supertype. * @since 2.0 */ public TypeLiteral<?> getReturnType(Method method) { if (!method.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(method + " is not defined by a supertype of " + type); } return resolve(method.getGenericReturnType()); } }
/** * Returns the resolved generic type of {@code field}. * * @param field a field defined by this or any superclass. * @since 2.0 */ public TypeLiteral<?> getFieldType(Field field) { if (!field.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(field + " is not defined by a supertype of " + type); } return resolve(field.getGenericType()); }
/** * Returns the resolved generic return type of {@code method}. * * @param method a method defined by this or any supertype. * @since 2.0 */ public TypeLiteral<?> getReturnType(Method method) { if (!method.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(method + " is not defined by a supertype of " + type); } return resolve(method.getGenericReturnType()); } }
/** * Returns the resolved generic return type of {@code method}. * * @param method a method defined by this or any supertype. * @since 2.0 */ public TypeLiteral<?> getReturnType(Method method) { checkArgument(method.getDeclaringClass().isAssignableFrom(rawType), "%s is not defined by a supertype of %s", method, type); return resolve(method.getGenericReturnType()); } }
/** * Returns the resolved generic type of {@code field}. * * @param field a field defined by this or any superclass. * @since 2.0 */ public TypeLiteral<?> getFieldType(Field field) { checkArgument(field.getDeclaringClass().isAssignableFrom(rawType), "%s is not defined by a supertype of %s", field, type); return resolve(field.getGenericType()); }
/** * Returns the generic form of {@code supertype}. For example, if this is {@code * ArrayList<String>}, this returns {@code Iterable<String>} given the input {@code * Iterable.class}. * * @param supertype a superclass of, or interface implemented by, this. * @since 2.0 */ public TypeLiteral<?> getSupertype(Class<?> supertype) { if (!supertype.isAssignableFrom(rawType)) { throw new IllegalArgumentException(supertype + " is not a supertype of " + type); } return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype)); }
/** * Returns the generic form of {@code supertype}. For example, if this is {@code * ArrayList<String>}, this returns {@code Iterable<String>} given the input {@code * Iterable.class}. * * @param supertype a superclass of, or interface implemented by, this. * @since 2.0 */ public TypeLiteral<?> getSupertype(Class<?> supertype) { if (!supertype.isAssignableFrom(rawType)) { throw new IllegalArgumentException(supertype + " is not a supertype of " + type); } return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype)); }
/** * Returns the generic form of {@code supertype}. For example, if this is {@code * ArrayList<String>}, this returns {@code Iterable<String>} given the input {@code * Iterable.class}. * * @param supertype a superclass of, or interface implemented by, this. * @since 2.0 */ public TypeLiteral<?> getSupertype(Class<?> supertype) { if (!supertype.isAssignableFrom(rawType)) { throw new IllegalArgumentException(supertype + " is not a supertype of " + type); } return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype)); }
/** * Returns the generic form of {@code supertype}. For example, if this is {@code * ArrayList<String>}, this returns {@code Iterable<String>} given the input {@code * Iterable.class}. * * @param supertype a superclass of, or interface implemented by, this. * @since 2.0 */ public TypeLiteral<?> getSupertype(Class<?> supertype) { checkArgument(supertype.isAssignableFrom(rawType), "%s is not a supertype of %s", supertype, this.type); return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype)); }