@Test void primitiveComponentOfNonPrimitiveThrows() { calling(() -> TypeUtil.primitiveComponentType(Byte[].class)) .shouldThrow(IllegalArgumentException.class) .withMessage("Byte[] is not a primative array."); }
@SuppressWarnings({"SuspiciousMethodCalls"}) public static Class<?> primitiveComponentType(Type primitiveArrayType) { return Optional.ofNullable(ARRAY_TO_PRIMITIVE.get(primitiveArrayType)) .orElseThrow(() -> new IllegalArgumentException(toString(primitiveArrayType) + " is not a primative array.")); }
TypeUtil extends UtilityClass { @SuppressWarnings({"SuspiciousMethodCalls"}) public static Class<?> primitiveComponentType(Type primitiveArrayType) { return Optional.ofNullable(ARRAY_TO_PRIMITIVE.get(primitiveArrayType)) .orElseThrow(() -> new IllegalArgumentException(toString(primitiveArrayType) + " is not a primative array.")); } }
TypeUtil extends UtilityClass { @SuppressWarnings({"SuspiciousMethodCalls"}) public static Class<?> primitiveComponentType(Type primitiveArrayType) { return Optional.ofNullable(ARRAY_TO_PRIMITIVE.get(primitiveArrayType)) .orElseThrow(() -> new IllegalArgumentException(toString(primitiveArrayType) + " is not a primative array.")); }  }
TypeUtil extends UtilityClass { @SuppressWarnings({"SuspiciousMethodCalls"}) public static Class<?> primitiveComponentType(Type primitiveArrayType) { return Optional.ofNullable(ARRAY_TO_PRIMITIVE.get(primitiveArrayType)) .orElseThrow(() -> new IllegalArgumentException(toString(primitiveArrayType) + " is not a primative array.")); }  @SuppressWarnings("unchecked") static Class<V> boxedType(Class<V> primitiveType); @SuppressWarnings("unchecked") static TypeToken<V> boxedType(TypeToken<V> primitiveType); @SuppressWarnings({"SuspiciousMethodCalls"}) static Class<?> primitiveComponentType(Type primitiveArrayType); static Optional<Class<?>> findPrimitiveArrayType(Type primitiveComponentType); static Class<?> actualTypeArgument(ParameterizedType parameterizedType, int i); static String toString(Type type); }
TypeUtil extends UtilityClass { @SuppressWarnings({"SuspiciousMethodCalls"}) public static Class<?> primitiveComponentType(Type primitiveArrayType) { return Optional.ofNullable(ARRAY_TO_PRIMITIVE.get(primitiveArrayType)) .orElseThrow(() -> new IllegalArgumentException(toString(primitiveArrayType) + " is not a primative array.")); }  @SuppressWarnings("unchecked") static Class<V> boxedType(Class<V> primitiveType); @SuppressWarnings("unchecked") static TypeToken<V> boxedType(TypeToken<V> primitiveType); @SuppressWarnings({"SuspiciousMethodCalls"}) static Class<?> primitiveComponentType(Type primitiveArrayType); static Optional<Class<?>> findPrimitiveArrayType(Type primitiveComponentType); static Class<?> actualTypeArgument(ParameterizedType parameterizedType, int i); static String toString(Type type);  }