/** * Local helper method to unroll variables in a type bounds array. * * @param typeArguments assignments {@link Map} * @param bounds in which to expand variables * @return {@code bounds} with any variables reassigned * @since 3.2 */ private static Type[] unrollBounds(final Map<TypeVariable<?>, Type> typeArguments, final Type[] bounds) { Type[] result = bounds; int i = 0; for (; i < result.length; i++) { final Type unrolled = unrollVariables(typeArguments, result[i]); if (unrolled == null) { result = ArrayUtils.remove(result, i--); } else { result[i] = unrolled; } } return result; }
final Type childType = TypeUtils.unrollVariables(typeArguments, method.getGenericParameterTypes()[i]); final Type parentType = TypeUtils.unrollVariables(typeArguments, m.getGenericParameterTypes()[i]); if (!TypeUtils.equals(childType, parentType)) { continue hierarchyTraversal;
return unrollVariables(typeArguments, typeArguments.get(type)); final Type unrolled = unrollVariables(parameterizedTypeArguments, args[i]); if (unrolled != null) { args[i] = unrolled;
@Test public void testParameterizeNarrowerTypeArray() { final TypeVariable<?>[] variables = ArrayList.class.getTypeParameters(); final ParameterizedType parameterizedType = TypeUtils.parameterize(ArrayList.class, variables); final Map<TypeVariable<?>, Type> mapping = Collections.<TypeVariable<?>, Type>singletonMap(variables[0], String.class); final Type unrolled = TypeUtils.unrollVariables(mapping, parameterizedType); assertEquals(TypeUtils.parameterize(ArrayList.class, String.class), unrolled); }
/** * Local helper method to unroll variables in a type bounds array. * * @param typeArguments assignments {@link Map} * @param bounds in which to expand variables * @return {@code bounds} with any variables reassigned * @since 3.2 */ private static Type[] unrollBounds(final Map<TypeVariable<?>, Type> typeArguments, final Type[] bounds) { Type[] result = bounds; int i = 0; for (; i < result.length; i++) { final Type unrolled = unrollVariables(typeArguments, result[i]); if (unrolled == null) { result = ArrayUtils.remove(result, i--); } else { result[i] = unrolled; } } return result; }
/** * Local helper method to unroll variables in a type bounds array. * * @param typeArguments assignments {@link Map} * @param bounds in which to expand variables * @return {@code bounds} with any variables reassigned * @since 3.2 */ private static Type[] unrollBounds(final Map<TypeVariable<?>, Type> typeArguments, final Type[] bounds) { Type[] result = bounds; int i = 0; for (; i < result.length; i++) { final Type unrolled = unrollVariables(typeArguments, result[i]); if (unrolled == null) { result = ArrayUtils.remove(result, i--); } else { result[i] = unrolled; } } return result; }
/** * Local helper method to unroll variables in a type bounds array. * * @param typeArguments assignments {@link Map} * @param bounds in which to expand variables * @return {@code bounds} with any variables reassigned * @since 3.2 */ private static Type[] unrollBounds(final Map<TypeVariable<?>, Type> typeArguments, final Type[] bounds) { Type[] result = bounds; int i = 0; for (; i < result.length; i++) { final Type unrolled = unrollVariables(typeArguments, result[i]); if (unrolled == null) { result = ArrayUtils.remove(result, i--); } else { result[i] = unrolled; } } return result; }
Type childType = TypeUtils.unrollVariables(typeArguments, method.getGenericParameterTypes()[i]); Type parentType = TypeUtils.unrollVariables(typeArguments, m.getGenericParameterTypes()[i]); if (!TypeUtils.equals(childType, parentType)) { continue hierarchyTraversal;
/** * Get the Java class and generic type managed by this marshaller. If not found, search in the parent. * * @param clazz The marshaller class to analyse. * @since 7.2 */ private void loadMarshalledType(Class<?> clazz) { if (isWriter() || isReader()) { Map<TypeVariable<?>, Type> typeArguments = TypeUtils.getTypeArguments(clazz, Marshaller.class); for (Map.Entry<TypeVariable<?>, Type> entry : typeArguments.entrySet()) { if (Marshaller.class.equals(entry.getKey().getGenericDeclaration())) { genericType = TypeUtils.unrollVariables(typeArguments, entry.getValue()); marshalledType = TypeUtils.getRawType(genericType, null); break; } } } }
final Type childType = TypeUtils.unrollVariables(typeArguments, method.getGenericParameterTypes()[i]); final Type parentType = TypeUtils.unrollVariables(typeArguments, m.getGenericParameterTypes()[i]); if (!TypeUtils.equals(childType, parentType)) { continue hierarchyTraversal;
final Type childType = TypeUtils.unrollVariables(typeArguments, method.getGenericParameterTypes()[i]); final Type parentType = TypeUtils.unrollVariables(typeArguments, m.getGenericParameterTypes()[i]); if (!TypeUtils.equals(childType, parentType)) { continue hierarchyTraversal;
final Type childType = TypeUtils.unrollVariables(typeArguments, method.getGenericParameterTypes()[i]); final Type parentType = TypeUtils.unrollVariables(typeArguments, m.getGenericParameterTypes()[i]); if (!TypeUtils.equals(childType, parentType)) { continue hierarchyTraversal;
return unrollVariables(typeArguments, typeArguments.get(type)); final Type unrolled = unrollVariables(parameterizedTypeArguments, args[i]); if (unrolled != null) { args[i] = unrolled;
return unrollVariables(typeArguments, typeArguments.get(type)); final Type unrolled = unrollVariables(parameterizedTypeArguments, args[i]); if (unrolled != null) { args[i] = unrolled;
return unrollVariables(typeArguments, typeArguments.get(type)); final Type unrolled = unrollVariables(parameterizedTypeArguments, args[i]); if (unrolled != null) { args[i] = unrolled;