Package dk.cloudcreate.essentials.shared.types
package dk.cloudcreate.essentials.shared.types
-
ClassesClassDescriptionGenericType<T>Using this class makes it possible to capture a generic/parameterized argument type, such as
List<Money>, instead of having to rely on the classical.classconstruct.
When you specify a type reference using.classyou loose any Generic/Parameterized information, as you cannot writeList<Money>.class, onlyList.class.
WithGenericTypeyou can specify and capture parameterized type information
You can specify a parameterized type usingGenericType:
var genericType = new GenericType<List<Money>>(){};
TheGenericType.type/GenericType.getType()will returnList.class
AndGenericType.genericType/GenericType.getGenericType()will returnParameterizedType, which can be introspected further
You can also supply a non-parameterized type toGenericType:
var genericType = new GenericType<Money>(){};
In which caseGenericType.type/GenericType.getType()will returnMoney.class
AndGenericType.genericType/GenericType.getGenericType()will returnMoney.class