/** * Returns the {@link TypeInformation} for the given atomic field. Will inspect fields first and return the type of a * field if available. Otherwise it will fall back to a {@link PropertyDescriptor}. * * @see #getGenericType(PropertyDescriptor) * @param fieldname * @return */ @SuppressWarnings("null") private Optional<TypeInformation<?>> getPropertyInformation(String fieldname) { Class<?> rawType = getType(); Field field = ReflectionUtils.findField(rawType, fieldname); if (field != null) { return Optional.of(createInfo(field.getGenericType())); } return findPropertyDescriptor(rawType, fieldname).map(it -> createInfo(getGenericType(it))); }
/** * Returns the {@link TypeInformation} for the given atomic field. Will inspect fields first and return the type of a * field if available. Otherwise it will fall back to a {@link PropertyDescriptor}. * * @see #getGenericType(PropertyDescriptor) * @param fieldname * @return */ private TypeInformation<?> getPropertyInformation(String fieldname) { Class<?> type = getType(); Field field = ReflectionUtils.findField(type, fieldname); if (field != null) { return createInfo(field.getGenericType()); } PropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(type, fieldname); return descriptor == null ? null : createInfo(getGenericType(descriptor)); }