@Test void rawClass() { TypeInfo sut = TypeInfo.ofParameter(randomMethod(), ZONED_DATE_TIME_PARAMETER); Class<?> result = sut.rawClass(); assertThat(result, equalTo(ZonedDateTime.class)); }
public Class<?> rawClass() { return parameterizedType .map(ParameterizedType::getRawType) .map(Class.class::cast) .orElseGet(() -> genericArrayType .flatMap(x -> ClassUtil.forArrayOf(of(x.getGenericComponentType()).rawClass())) .orElseGet(() -> (Class) type)); }
TypeInfo { public Class<?> rawClass() { return parameterizedType .map(ParameterizedType::getRawType) .map(Class.class::cast) .orElseGet(() -> genericArrayType .flatMap(x -> ClassUtil.forArrayOf(of(x.getGenericComponentType()).rawClass())) .orElseGet(() -> (Class) type)); } }
TypeInfo { public Class<?> rawClass() { return parameterizedType .map(ParameterizedType::getRawType) .map(Class.class::cast) .orElseGet(() -> genericArrayType .flatMap(x -> ClassUtil.forArrayOf(of(x.getGenericComponentType()).rawClass())) .orElseGet(() -> (Class) type)); } private  TypeInfo(Type type); }
TypeInfo { public Class<?> rawClass() { return parameterizedType .map(ParameterizedType::getRawType) .map(Class.class::cast) .orElseGet(() -> genericArrayType .flatMap(x -> ClassUtil.forArrayOf(of(x.getGenericComponentType()).rawClass())) .orElseGet(() -> (Class) type)); } private  TypeInfo(Type type); @Override String toString(); TypeInfo arrayComponentType(); TypeInfo actualTypeArgument(int index); Class<?> rawClass(); static TypeInfo ofParameter(Method method, int parameter); }
TypeInfo { public Class<?> rawClass() { return parameterizedType .map(ParameterizedType::getRawType) .map(Class.class::cast) .orElseGet(() -> genericArrayType .flatMap(x -> ClassUtil.forArrayOf(of(x.getGenericComponentType()).rawClass())) .orElseGet(() -> (Class) type)); } private  TypeInfo(Type type); @Override String toString(); TypeInfo arrayComponentType(); TypeInfo actualTypeArgument(int index); Class<?> rawClass(); static TypeInfo ofParameter(Method method, int parameter);  }