/** * Simple factory method to easily create new instances of {@link ClassTypeInformation}. * * @param <S> * @param type * @return */ public static <S> TypeInformation<S> from(Class<S> type) { Reference<TypeInformation<?>> cachedReference = CACHE.get(type); TypeInformation<?> cachedTypeInfo = cachedReference == null ? null : cachedReference.get(); if (cachedTypeInfo != null) { return (TypeInformation<S>) cachedTypeInfo; } TypeInformation<S> result = new ClassTypeInformation<S>(type); CACHE.put(type, new WeakReference<TypeInformation<?>>(result)); return result; }
/** * Creates a {@link TypeInformation} from the given method's return type. * * @param method * @return */ public static <S> TypeInformation<S> fromReturnTypeOf(Method method) { return new ClassTypeInformation(method.getDeclaringClass()).createInfo(method.getGenericReturnType()); }
return new ClassTypeInformation((Class<?>) fieldType);