Class DataTypeExtractor


  • @Internal
    public final class DataTypeExtractor
    extends Object
    Reflection-based utility that analyzes a given Type, method, or class to extract a (possibly nested) DataType from it.
    • Method Detail

      • extractFromType

        public static DataType extractFromType​(DataTypeFactory typeFactory,
                                               Type type)
        Extracts a data type from a type without considering surrounding classes or templates.
      • extractFromType

        public static DataType extractFromType​(DataTypeFactory typeFactory,
                                               org.apache.flink.table.types.extraction.DataTypeTemplate template,
                                               Type type)
        Extracts a data type from a type without considering surrounding classes but templates.
      • extractFromGeneric

        public static DataType extractFromGeneric​(DataTypeFactory typeFactory,
                                                  Class<?> baseClass,
                                                  int genericPos,
                                                  Type contextType)
        Extracts a data type from a type variable at genericPos of baseClass using the information of the most specific type contextType.
      • extractFromMethodParameter

        public static DataType extractFromMethodParameter​(DataTypeFactory typeFactory,
                                                          Class<?> baseClass,
                                                          Method method,
                                                          int paramPos)
        Extracts a data type from a method parameter by considering surrounding classes and parameter annotation.
      • extractFromGenericMethodParameter

        public static DataType extractFromGenericMethodParameter​(DataTypeFactory typeFactory,
                                                                 Class<?> baseClass,
                                                                 Method method,
                                                                 int paramPos,
                                                                 int genericPos)
        Extracts a data type from a method parameter by considering surrounding classes and parameter annotation. This version assumes that the parameter is a generic type, and uses the generic position type as the extracted data type. For example, if the parameter is a CompletableFuture<Long> and genericPos is 0, it will extract Long.
      • extractFromMethodOutput

        public static DataType extractFromMethodOutput​(DataTypeFactory typeFactory,
                                                       Class<?> baseClass,
                                                       Method method)
        Extracts a data type from a method return type by considering surrounding classes and method annotation.
      • extractFromMethodOutput

        public static DataType extractFromMethodOutput​(DataTypeFactory typeFactory,
                                                       Class<?> baseClass,
                                                       Method method,
                                                       Type methodReturnType)
        Extracts a data type from a method return type with specifying the method's type explicitly by considering surrounding classes and method annotation.