Class DescriptorProperties


  • @Deprecated
    @Internal
    public class DescriptorProperties
    extends Object
    Deprecated.
    This utility will be dropped soon. DynamicTableFactory is based on ConfigOption and catalogs use CatalogPropertiesUtil.
    Utility class for having a unified string-based representation of Table API related classes such as TableSchema, TypeInformation, etc.

    Note to implementers: Please try to reuse key names as much as possible. Key-names should be hierarchical and lower case. Use "-" instead of dots or camel case. E.g., connector.schema.start-from = from-earliest. Try not to use the higher level in a key-name. E.g., instead of connector.kafka.kafka-version use connector.kafka.version.

    Properties with key normalization enabled contain only lower-case keys.

    • Constructor Detail

      • DescriptorProperties

        public DescriptorProperties​(boolean normalizeKeys)
        Deprecated.
      • DescriptorProperties

        public DescriptorProperties()
        Deprecated.
    • Method Detail

      • putProperties

        public void putProperties​(Map<String,​String> properties)
        Deprecated.
        Adds a set of properties.
      • putProperties

        public void putProperties​(DescriptorProperties otherProperties)
        Deprecated.
        Adds a set of descriptor properties.
      • putPropertiesWithPrefix

        public void putPropertiesWithPrefix​(String prefix,
                                            Map<String,​String> prop)
        Deprecated.
        Adds a properties map by appending the given prefix to element keys with a dot.

        For example: for prefix "flink" and a map of a single property with key "k" and value "v". The added property will be as key "flink.k" and value "v".

      • putClass

        public void putClass​(String key,
                             Class<?> clazz)
        Deprecated.
        Adds a class under the given key.
      • putString

        public void putString​(String key,
                              String str)
        Deprecated.
        Adds a string under the given key.
      • putBoolean

        public void putBoolean​(String key,
                               boolean b)
        Deprecated.
        Adds a boolean under the given key.
      • putLong

        public void putLong​(String key,
                            long l)
        Deprecated.
        Adds a long under the given key.
      • putInt

        public void putInt​(String key,
                           int i)
        Deprecated.
        Adds an integer under the given key.
      • putCharacter

        public void putCharacter​(String key,
                                 char c)
        Deprecated.
        Adds a character under the given key.
      • putTableSchema

        public void putTableSchema​(String key,
                                   TableSchema schema)
        Deprecated.
        Adds a table schema under the given key.
      • putPartitionKeys

        public void putPartitionKeys​(List<String> keys)
        Deprecated.
        Adds table partition keys.
      • putMemorySize

        public void putMemorySize​(String key,
                                  MemorySize size)
        Deprecated.
        Adds a Flink MemorySize under the given key.
      • putIndexedFixedProperties

        public void putIndexedFixedProperties​(String key,
                                              List<String> subKeys,
                                              List<List<String>> subKeyValues)
        Deprecated.
        Adds an indexed sequence of properties (with sub-properties) under a common key.

        For example:

             schema.fields.0.type = INT, schema.fields.0.name = test
             schema.fields.1.type = LONG, schema.fields.1.name = test2
         

        The arity of each subKeyValues must match the arity of propertyKeys.

      • putIndexedOptionalProperties

        public void putIndexedOptionalProperties​(String key,
                                                 List<String> subKeys,
                                                 List<List<String>> subKeyValues)
        Deprecated.
        Adds an indexed sequence of properties (with sub-properties) under a common key. Different with putIndexedFixedProperties(java.lang.String, java.util.List<java.lang.String>, java.util.List<java.util.List<java.lang.String>>), this method supports the properties value to be null, which would be ignore. The sub-properties should at least have one non-null value.

        For example:

             schema.fields.0.type = INT, schema.fields.0.name = test
             schema.fields.1.type = LONG, schema.fields.1.name = test2
             schema.fields.2.type = LONG, schema.fields.2.name = test3, schema.fields.2.expr = test2 + 1
         

        The arity of each subKeyValues must match the arity of propertyKeys.

      • putIndexedVariableProperties

        public void putIndexedVariableProperties​(String key,
                                                 List<Map<String,​String>> subKeyValues)
        Deprecated.
        Adds an indexed mapping of properties under a common key.

        For example:

             schema.fields.0.type = INT, schema.fields.0.name = test
                                         schema.fields.1.name = test2
         

        The arity of the subKeyValues can differ.

      • getOptionalString

        public Optional<String> getOptionalString​(String key)
        Deprecated.
        Returns a string value under the given key if it exists.
      • getString

        public String getString​(String key)
        Deprecated.
        Returns a string value under the given existing key.
      • getOptionalCharacter

        public Optional<Character> getOptionalCharacter​(String key)
        Deprecated.
        Returns a character value under the given key if it exists.
      • getCharacter

        public Character getCharacter​(String key)
        Deprecated.
        Returns a character value under the given existing key.
      • getOptionalClass

        public <T> Optional<Class<T>> getOptionalClass​(String key,
                                                       Class<T> superClass)
        Deprecated.
        Returns a class value under the given key if it exists.
      • getClass

        public <T> Class<T> getClass​(String key,
                                     Class<T> superClass)
        Deprecated.
        Returns a class value under the given existing key.
      • getOptionalBigDecimal

        public Optional<BigDecimal> getOptionalBigDecimal​(String key)
        Deprecated.
        Returns a big decimal value under the given key if it exists.
      • getBigDecimal

        public BigDecimal getBigDecimal​(String key)
        Deprecated.
        Returns a big decimal value under the given existing key.
      • getOptionalBoolean

        public Optional<Boolean> getOptionalBoolean​(String key)
        Deprecated.
        Returns a boolean value under the given key if it exists.
      • getBoolean

        public boolean getBoolean​(String key)
        Deprecated.
        Returns a boolean value under the given existing key.
      • getOptionalByte

        public Optional<Byte> getOptionalByte​(String key)
        Deprecated.
        Returns a byte value under the given key if it exists.
      • getByte

        public byte getByte​(String key)
        Deprecated.
        Returns a byte value under the given existing key.
      • getOptionalDouble

        public Optional<Double> getOptionalDouble​(String key)
        Deprecated.
        Returns a double value under the given key if it exists.
      • getDouble

        public double getDouble​(String key)
        Deprecated.
        Returns a double value under the given existing key.
      • getOptionalFloat

        public Optional<Float> getOptionalFloat​(String key)
        Deprecated.
        Returns a float value under the given key if it exists.
      • getFloat

        public float getFloat​(String key)
        Deprecated.
        Returns a float value under the given given existing key.
      • getOptionalInt

        public Optional<Integer> getOptionalInt​(String key)
        Deprecated.
        Returns an integer value under the given key if it exists.
      • getInt

        public int getInt​(String key)
        Deprecated.
        Returns an integer value under the given existing key.
      • getOptionalLong

        public Optional<Long> getOptionalLong​(String key)
        Deprecated.
        Returns a long value under the given key if it exists.
      • getLong

        public long getLong​(String key)
        Deprecated.
        Returns a long value under the given existing key.
      • getOptionalShort

        public Optional<Short> getOptionalShort​(String key)
        Deprecated.
        Returns a short value under the given key if it exists.
      • getShort

        public short getShort​(String key)
        Deprecated.
        Returns a short value under the given existing key.
      • getOptionalType

        public Optional<TypeInformation<?>> getOptionalType​(String key)
        Deprecated.
        Returns the type information under the given key if it exists.
      • getType

        public TypeInformation<?> getType​(String key)
        Deprecated.
        Returns the type information under the given existing key.
      • getOptionalDataType

        public Optional<DataType> getOptionalDataType​(String key)
        Deprecated.
        Returns the DataType under the given key if it exists.
      • getDataType

        public DataType getDataType​(String key)
        Deprecated.
        Returns the DataType under the given existing key.
      • getOptionalTableSchema

        public Optional<TableSchema> getOptionalTableSchema​(String key)
        Deprecated.
        Returns a table schema under the given key if it exists.
      • getTableSchema

        public TableSchema getTableSchema​(String key)
        Deprecated.
        Returns a table schema under the given existing key.
      • getPartitionKeys

        public List<String> getPartitionKeys()
        Deprecated.
        Returns partition keys.
      • getMemorySize

        public MemorySize getMemorySize​(String key)
        Deprecated.
        Returns a Flink MemorySize under the given existing key.
      • getOptionalDuration

        public Optional<Duration> getOptionalDuration​(String key)
        Deprecated.
        Returns a Java Duration under the given key if it exists.
      • getDuration

        public Duration getDuration​(String key)
        Deprecated.
        Returns a java Duration under the given existing key.
      • getFixedIndexedProperties

        public List<Map<String,​String>> getFixedIndexedProperties​(String key,
                                                                        List<String> subKeys)
        Deprecated.
        Returns the property keys of fixed indexed properties.

        For example:

             schema.fields.0.type = INT, schema.fields.0.name = test
             schema.fields.1.type = LONG, schema.fields.1.name = test2
         

        getFixedIndexedProperties("schema.fields", List("type", "name")) leads to:

             0: Map("type" -> "schema.fields.0.type", "name" -> "schema.fields.0.name")
             1: Map("type" -> "schema.fields.1.type", "name" -> "schema.fields.1.name")
         
      • getVariableIndexedProperties

        public List<Map<String,​String>> getVariableIndexedProperties​(String key,
                                                                           List<String> requiredSubKeys)
        Deprecated.
        Returns the property keys of variable indexed properties.

        For example:

             schema.fields.0.type = INT, schema.fields.0.name = test
             schema.fields.1.type = LONG
         

        getFixedIndexedProperties("schema.fields", List("type")) leads to:

             0: Map("type" -> "schema.fields.0.type", "name" -> "schema.fields.0.name")
             1: Map("type" -> "schema.fields.1.type")
         
      • getIndexedProperty

        public Map<String,​String> getIndexedProperty​(String key,
                                                           String subKey)
        Deprecated.
        Returns all properties under a given key that contains an index in between.

        E.g. rowtime.0.name -> returns all rowtime.#.name properties

      • getOptionalArray

        public <E> Optional<List<E>> getOptionalArray​(String key,
                                                      Function<String,​E> keyMapper)
        Deprecated.
        Returns all array elements under a given key if it exists.

        For example:

             primary-key.0 = field1
             primary-key.1 = field2
         

        leads to: List(field1, field2)

        or:

             primary-key = field1
         

        leads to: List(field1)

        The key mapper gets the key of the current value e.g. "primary-key.1".

      • getArray

        public <E> List<E> getArray​(String key,
                                    Function<String,​E> keyMapper)
        Deprecated.
        Returns all array elements under a given existing key.
      • isValue

        public boolean isValue​(String key,
                               String value)
        Deprecated.
        Returns if a value under key is exactly equal to the given value.
      • getPropertiesWithPrefix

        public Map<String,​String> getPropertiesWithPrefix​(String prefix)
        Deprecated.
        Returns a map of properties whose key starts with the given prefix, and the prefix is removed upon return.

        For example, for prefix "flink" and a map of a single property with key "flink.k" and value "v", this method will return it as key "k" and value "v" by identifying and removing the prefix "flink".

      • validateString

        public void validateString​(String key,
                                   boolean isOptional)
        Deprecated.
        Validates a string property.
      • validateString

        public void validateString​(String key,
                                   boolean isOptional,
                                   int minLen)
        Deprecated.
        Validates a string property. The boundaries are inclusive.
      • validateString

        public void validateString​(String key,
                                   boolean isOptional,
                                   int minLen,
                                   int maxLen)
        Deprecated.
        Validates a string property. The boundaries are inclusive.
      • validateInt

        public void validateInt​(String key,
                                boolean isOptional)
        Deprecated.
        Validates an integer property.
      • validateInt

        public void validateInt​(String key,
                                boolean isOptional,
                                int min)
        Deprecated.
        Validates an integer property. The boundaries are inclusive.
      • validateInt

        public void validateInt​(String key,
                                boolean isOptional,
                                int min,
                                int max)
        Deprecated.
        Validates an integer property. The boundaries are inclusive.
      • validateLong

        public void validateLong​(String key,
                                 boolean isOptional)
        Deprecated.
        Validates an long property.
      • validateLong

        public void validateLong​(String key,
                                 boolean isOptional,
                                 long min)
        Deprecated.
        Validates an long property. The boundaries are inclusive.
      • validateLong

        public void validateLong​(String key,
                                 boolean isOptional,
                                 long min,
                                 long max)
        Deprecated.
        Validates an long property. The boundaries are inclusive.
      • validateValue

        public void validateValue​(String key,
                                  String value,
                                  boolean isOptional)
        Deprecated.
        Validates that a certain value is present under the given key.
      • validateBoolean

        public void validateBoolean​(String key,
                                    boolean isOptional)
        Deprecated.
        Validates that a boolean value is present under the given key.
      • validateDouble

        public void validateDouble​(String key,
                                   boolean isOptional)
        Deprecated.
        Validates a double property.
      • validateDouble

        public void validateDouble​(String key,
                                   boolean isOptional,
                                   double min)
        Deprecated.
        Validates a double property. The boundaries are inclusive.
      • validateDouble

        public void validateDouble​(String key,
                                   boolean isOptional,
                                   double min,
                                   double max)
        Deprecated.
        Validates a double property. The boundaries are inclusive.
      • validateBigDecimal

        public void validateBigDecimal​(String key,
                                       boolean isOptional)
        Deprecated.
        Validates a big decimal property.
      • validateBigDecimal

        public void validateBigDecimal​(String key,
                                       boolean isOptional,
                                       BigDecimal min,
                                       BigDecimal max)
        Deprecated.
        Validates a big decimal property. The boundaries are inclusive.
      • validateByte

        public void validateByte​(String key,
                                 boolean isOptional)
        Deprecated.
        Validates a byte property.
      • validateByte

        public void validateByte​(String key,
                                 boolean isOptional,
                                 byte min)
        Deprecated.
        Validates a byte property. The boundaries are inclusive.
      • validateByte

        public void validateByte​(String key,
                                 boolean isOptional,
                                 byte min,
                                 byte max)
        Deprecated.
        Validates a byte property. The boundaries are inclusive.
      • validateFloat

        public void validateFloat​(String key,
                                  boolean isOptional)
        Deprecated.
        Validates a float property.
      • validateFloat

        public void validateFloat​(String key,
                                  boolean isOptional,
                                  float min)
        Deprecated.
        Validates a float property. The boundaries are inclusive.
      • validateFloat

        public void validateFloat​(String key,
                                  boolean isOptional,
                                  float min,
                                  float max)
        Deprecated.
        Validates a float property. The boundaries are inclusive.
      • validateShort

        public void validateShort​(String key,
                                  boolean isOptional)
        Deprecated.
        Validates a short property.
      • validateShort

        public void validateShort​(String key,
                                  boolean isOptional,
                                  short min)
        Deprecated.
        Validates a short property. The boundaries are inclusive.
      • validateShort

        public void validateShort​(String key,
                                  boolean isOptional,
                                  short min,
                                  short max)
        Deprecated.
        Validates a short property. The boundaries are inclusive.
      • validateFixedIndexedProperties

        public void validateFixedIndexedProperties​(String key,
                                                   boolean allowEmpty,
                                                   Map<String,​Consumer<String>> subKeyValidation)
        Deprecated.
        Validation for fixed indexed properties.

        For example:

             schema.fields.0.data-type = INT, schema.fields.0.name = test
             schema.fields.1.data-type = BIGINT, schema.fields.1.name = test2
         

        The subKeyValidation map must define e.g. "data-type" and "name" and a validation logic for the given full key.

      • validateTableSchema

        public void validateTableSchema​(String key,
                                        boolean isOptional)
        Deprecated.
        Validates a table schema property.
      • validateMemorySize

        public void validateMemorySize​(String key,
                                       boolean isOptional,
                                       int precision)
        Deprecated.
        Validates a Flink MemorySize.

        The precision defines the allowed minimum unit in bytes (e.g. 1024 would only allow KB).

      • validateMemorySize

        public void validateMemorySize​(String key,
                                       boolean isOptional,
                                       int precision,
                                       long min)
        Deprecated.
        Validates a Flink MemorySize. The boundaries are inclusive and in bytes.

        The precision defines the allowed minimum unit in bytes (e.g. 1024 would only allow KB).

      • validateMemorySize

        public void validateMemorySize​(String key,
                                       boolean isOptional,
                                       int precision,
                                       long min,
                                       long max)
        Deprecated.
        Validates a Flink MemorySize. The boundaries are inclusive and in bytes.

        The precision defines the allowed minimum unit in bytes (e.g. 1024 would only allow KB).

      • validateDuration

        public void validateDuration​(String key,
                                     boolean isOptional,
                                     int precision)
        Deprecated.
        Validates a Java Duration.

        The precision defines the allowed minimum unit in milliseconds (e.g. 1000 would only allow seconds).

      • validateDuration

        public void validateDuration​(String key,
                                     boolean isOptional,
                                     int precision,
                                     long min)
        Deprecated.
        Validates a Java Duration. The boundaries are inclusive and in milliseconds.

        The precision defines the allowed minimum unit in milliseconds (e.g. 1000 would only allow seconds).

      • validateDuration

        public void validateDuration​(String key,
                                     boolean isOptional,
                                     int precision,
                                     long min,
                                     long max)
        Deprecated.
        Validates a Java Duration. The boundaries are inclusive and in milliseconds.

        The precision defines the allowed minimum unit in milliseconds (e.g. 1000 would only allow seconds).

      • validateEnum

        public void validateEnum​(String key,
                                 boolean isOptional,
                                 Map<String,​Consumer<String>> enumValidation)
        Deprecated.
        Validates an enum property with a set of validation logic for each enum value.
      • validateEnumValues

        public void validateEnumValues​(String key,
                                       boolean isOptional,
                                       List<String> values)
        Deprecated.
        Validates an enum property with a set of enum values.
      • validateType

        public void validateType​(String key,
                                 boolean isOptional,
                                 boolean requireRow)
        Deprecated.
        Validates a type property.
      • validateDataType

        public void validateDataType​(String key,
                                     String fallbackKey,
                                     boolean isOptional)
        Deprecated.
        Validates a data type property.
      • validateArray

        public void validateArray​(String key,
                                  Consumer<String> elementValidation,
                                  int minLength)
        Deprecated.
        Validates an array of values.

        For example:

             primary-key.0 = field1
             primary-key.1 = field2
         

        leads to: List(field1, field2)

        or:

             primary-key = field1
         

        The validation consumer gets the key of the current value e.g. "primary-key.1".

      • validateArray

        public void validateArray​(String key,
                                  Consumer<String> elementValidation,
                                  int minLength,
                                  int maxLength)
        Deprecated.
        Validates an array of values.

        For example:

             primary-key.0 = field1
             primary-key.1 = field2
         

        leads to: List(field1, field2)

        or:

             primary-key = field1
         

        The validation consumer gets the key of the current value e.g. "primary-key.1".

      • validatePrefixExclusion

        public void validatePrefixExclusion​(String prefix)
        Deprecated.
        Validates that the given prefix is not included in these properties.
      • validateExclusion

        public void validateExclusion​(String key)
        Deprecated.
        Validates that the given key is not included in these properties.
      • containsKey

        public boolean containsKey​(String key)
        Deprecated.
        Returns if the given key is contained.
      • hasPrefix

        public boolean hasPrefix​(String prefix)
        Deprecated.
        Returns if a given prefix exists in the properties.
      • asMap

        public Map<String,​String> asMap()
        Deprecated.
        Returns the properties as a map copy.
      • asPrefixedMap

        public Map<String,​String> asPrefixedMap​(String prefix)
        Deprecated.
        Returns the properties as a map copy with a prefix key.
      • withoutKeys

        public DescriptorProperties withoutKeys​(List<String> keys)
        Deprecated.
        Returns a new properties instance with the given keys removed.
      • equals

        public boolean equals​(Object o)
        Deprecated.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Deprecated.
        Overrides:
        hashCode in class Object
      • noValidation

        public static Consumer<String> noValidation()
        Deprecated.
        Returns an empty validation logic.
      • toString

        public static String toString​(String str)
        Deprecated.