@Test(expected = ValidationException.class) public void testInvalidFixedIndexedProperties() { DescriptorProperties property = new DescriptorProperties(); List<List<String>> list = new ArrayList<>(); list.add(Arrays.asList("1", "string")); list.add(Arrays.asList("INVALID", "string")); property.putIndexedFixedProperties( FIXED_INDEXED_PROPERTY_KEY, Arrays.asList(PROPERTY_1_KEY, PROPERTY_2_KEY), list); testFixedIndexedPropertiesValidation(property); }
public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeys); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final List<String> values = subKeyValues.get(idx); if (values == null || values.size() != subKeys.size()) { throw new ValidationException("Values must have same arity as keys."); } for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) { put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx)); } } }
DescriptorProperties { public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeys); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final List<String> values = subKeyValues.get(idx); if (values == null || values.size() != subKeys.size()) { throw new ValidationException("Values must have same arity as keys."); } for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) { put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx)); } } } }
DescriptorProperties { public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeys); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final List<String> values = subKeyValues.get(idx); if (values == null || values.size() != subKeys.size()) { throw new ValidationException("Values must have same arity as keys."); } for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) { put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx)); } } } DescriptorProperties(boolean normalizeKeys);  DescriptorProperties(); }
DescriptorProperties { public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeys); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final List<String> values = subKeyValues.get(idx); if (values == null || values.size() != subKeys.size()) { throw new ValidationException("Values must have same arity as keys."); } for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) { put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx)); } } } DescriptorProperties(boolean normalizeKeys);  DescriptorProperties(); void putProperties(Map<String, String> properties); void putProperties(DescriptorProperties otherProperties); void putPropertiesWithPrefix(String prefix, Map<String, String> prop); void putClass(String key, Class<?> clazz); void putString(String key, String str); void putBoolean(String key, boolean b); void putLong(String key, long l); void putInt(String key, int i); void putCharacter(String key, char c); void putTableSchema(String key, TableSchema schema); void putMemorySize(String key, MemorySize size); void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues); void putIndexedVariableProperties(String key, List<Map<String, String>> subKeyValues); Optional<String> getOptionalString(String key); String getString(String key); Optional<Character> getOptionalCharacter(String key); Character getCharacter(String key); @SuppressWarnings("unchecked") Optional<Class<T>> getOptionalClass(String key, Class<T> superClass); Class<T> getClass(String key, Class<T> superClass); Optional<BigDecimal> getOptionalBigDecimal(String key); BigDecimal getBigDecimal(String key); Optional<Boolean> getOptionalBoolean(String key); boolean getBoolean(String key); Optional<Byte> getOptionalByte(String key); byte getByte(String key); Optional<Double> getOptionalDouble(String key); double getDouble(String key); Optional<Float> getOptionalFloat(String key); float getFloat(String key); Optional<Integer> getOptionalInt(String key); int getInt(String key); Optional<Long> getOptionalLong(String key); long getLong(String key); Optional<Short> getOptionalShort(String key); short getShort(String key); Optional<TypeInformation<?>> getOptionalType(String key); TypeInformation<?> getType(String key); Optional<TableSchema> getOptionalTableSchema(String key); TableSchema getTableSchema(String key); Optional<MemorySize> getOptionalMemorySize(String key); MemorySize getMemorySize(String key); Optional<Duration> getOptionalDuration(String key); Duration getDuration(String key); List<Map<String, String>> getFixedIndexedProperties(String key, List<String> subKeys); List<Map<String, String>> getVariableIndexedProperties(String key, List<String> requiredSubKeys); Map<String, String> getIndexedProperty(String key, String subKey); Optional<List<E>> getOptionalArray(String key, Function<String, E> keyMapper); List<E> getArray(String key, Function<String, E> keyMapper); boolean isValue(String key, String value); Map<String, String> getPropertiesWithPrefix(String prefix); void validateString(String key, boolean isOptional); void validateString(String key, boolean isOptional, int minLen); void validateString(String key, boolean isOptional, int minLen, int maxLen); void validateInt(String key, boolean isOptional); void validateInt(String key, boolean isOptional, int min); void validateInt(String key, boolean isOptional, int min, int max); void validateLong(String key, boolean isOptional); void validateLong(String key, boolean isOptional, long min); void validateLong(String key, boolean isOptional, long min, long max); void validateValue(String key, String value, boolean isOptional); void validateBoolean(String key, boolean isOptional); void validateDouble(String key, boolean isOptional); void validateDouble(String key, boolean isOptional, double min); void validateDouble(String key, boolean isOptional, double min, double max); void validateBigDecimal(String key, boolean isOptional); void validateBigDecimal(String key, boolean isOptional, BigDecimal min, BigDecimal max); void validateByte(String key, boolean isOptional); void validateByte(String key, boolean isOptional, byte min); void validateByte(String key, boolean isOptional, byte min, byte max); void validateFloat(String key, boolean isOptional); void validateFloat(String key, boolean isOptional, float min); void validateFloat(String key, boolean isOptional, float min, float max); void validateShort(String key, boolean isOptional); void validateShort(String key, boolean isOptional, short min); void validateShort(String key, boolean isOptional, short min, short max); void validateFixedIndexedProperties(String key, boolean allowEmpty, Map<String, Consumer<String>> subKeyValidation); void validateTableSchema(String key, boolean isOptional); void validateMemorySize(String key, boolean isOptional, int precision); void validateMemorySize(String key, boolean isOptional, int precision, long min); void validateMemorySize(String key, boolean isOptional, int precision, long min, long max); void validateDuration(String key, boolean isOptional, int precision); void validateDuration(String key, boolean isOptional, int precision, long min); void validateDuration(String key, boolean isOptional, int precision, long min, long max); void validateEnum(String key, boolean isOptional, Map<String, Consumer<String>> enumValidation); void validateEnumValues(String key, boolean isOptional, List<String> values); void validateType(String key, boolean isOptional, boolean requireRow); void validateArray(String key, Consumer<String> elementValidation, int minLength); void validateArray(String key, Consumer<String> elementValidation, int minLength, int maxLength); void validatePrefixExclusion(String prefix); void validateExclusion(String key); boolean containsKey(String key); boolean hasPrefix(String prefix); Map<String, String> asMap(); Map<String, String> asPrefixedMap(String prefix); DescriptorProperties withoutKeys(List<String> keys); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Consumer<String> noValidation(); static String toString(String str); static String toString(String key, String value); static String toString(Map<String, String> propertyMap); }
DescriptorProperties { public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeys); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final List<String> values = subKeyValues.get(idx); if (values == null || values.size() != subKeys.size()) { throw new ValidationException("Values must have same arity as keys."); } for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) { put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx)); } } } DescriptorProperties(boolean normalizeKeys);  DescriptorProperties(); void putProperties(Map<String, String> properties); void putProperties(DescriptorProperties otherProperties); void putPropertiesWithPrefix(String prefix, Map<String, String> prop); void putClass(String key, Class<?> clazz); void putString(String key, String str); void putBoolean(String key, boolean b); void putLong(String key, long l); void putInt(String key, int i); void putCharacter(String key, char c); void putTableSchema(String key, TableSchema schema); void putMemorySize(String key, MemorySize size); void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues); void putIndexedVariableProperties(String key, List<Map<String, String>> subKeyValues); Optional<String> getOptionalString(String key); String getString(String key); Optional<Character> getOptionalCharacter(String key); Character getCharacter(String key); @SuppressWarnings("unchecked") Optional<Class<T>> getOptionalClass(String key, Class<T> superClass); Class<T> getClass(String key, Class<T> superClass); Optional<BigDecimal> getOptionalBigDecimal(String key); BigDecimal getBigDecimal(String key); Optional<Boolean> getOptionalBoolean(String key); boolean getBoolean(String key); Optional<Byte> getOptionalByte(String key); byte getByte(String key); Optional<Double> getOptionalDouble(String key); double getDouble(String key); Optional<Float> getOptionalFloat(String key); float getFloat(String key); Optional<Integer> getOptionalInt(String key); int getInt(String key); Optional<Long> getOptionalLong(String key); long getLong(String key); Optional<Short> getOptionalShort(String key); short getShort(String key); Optional<TypeInformation<?>> getOptionalType(String key); TypeInformation<?> getType(String key); Optional<TableSchema> getOptionalTableSchema(String key); TableSchema getTableSchema(String key); Optional<MemorySize> getOptionalMemorySize(String key); MemorySize getMemorySize(String key); Optional<Duration> getOptionalDuration(String key); Duration getDuration(String key); List<Map<String, String>> getFixedIndexedProperties(String key, List<String> subKeys); List<Map<String, String>> getVariableIndexedProperties(String key, List<String> requiredSubKeys); Map<String, String> getIndexedProperty(String key, String subKey); Optional<List<E>> getOptionalArray(String key, Function<String, E> keyMapper); List<E> getArray(String key, Function<String, E> keyMapper); boolean isValue(String key, String value); Map<String, String> getPropertiesWithPrefix(String prefix); void validateString(String key, boolean isOptional); void validateString(String key, boolean isOptional, int minLen); void validateString(String key, boolean isOptional, int minLen, int maxLen); void validateInt(String key, boolean isOptional); void validateInt(String key, boolean isOptional, int min); void validateInt(String key, boolean isOptional, int min, int max); void validateLong(String key, boolean isOptional); void validateLong(String key, boolean isOptional, long min); void validateLong(String key, boolean isOptional, long min, long max); void validateValue(String key, String value, boolean isOptional); void validateBoolean(String key, boolean isOptional); void validateDouble(String key, boolean isOptional); void validateDouble(String key, boolean isOptional, double min); void validateDouble(String key, boolean isOptional, double min, double max); void validateBigDecimal(String key, boolean isOptional); void validateBigDecimal(String key, boolean isOptional, BigDecimal min, BigDecimal max); void validateByte(String key, boolean isOptional); void validateByte(String key, boolean isOptional, byte min); void validateByte(String key, boolean isOptional, byte min, byte max); void validateFloat(String key, boolean isOptional); void validateFloat(String key, boolean isOptional, float min); void validateFloat(String key, boolean isOptional, float min, float max); void validateShort(String key, boolean isOptional); void validateShort(String key, boolean isOptional, short min); void validateShort(String key, boolean isOptional, short min, short max); void validateFixedIndexedProperties(String key, boolean allowEmpty, Map<String, Consumer<String>> subKeyValidation); void validateTableSchema(String key, boolean isOptional); void validateMemorySize(String key, boolean isOptional, int precision); void validateMemorySize(String key, boolean isOptional, int precision, long min); void validateMemorySize(String key, boolean isOptional, int precision, long min, long max); void validateDuration(String key, boolean isOptional, int precision); void validateDuration(String key, boolean isOptional, int precision, long min); void validateDuration(String key, boolean isOptional, int precision, long min, long max); void validateEnum(String key, boolean isOptional, Map<String, Consumer<String>> enumValidation); void validateEnumValues(String key, boolean isOptional, List<String> values); void validateType(String key, boolean isOptional, boolean requireRow); void validateArray(String key, Consumer<String> elementValidation, int minLength); void validateArray(String key, Consumer<String> elementValidation, int minLength, int maxLength); void validatePrefixExclusion(String prefix); void validateExclusion(String key); boolean containsKey(String key); boolean hasPrefix(String prefix); Map<String, String> asMap(); Map<String, String> asPrefixedMap(String prefix); DescriptorProperties withoutKeys(List<String> keys); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Consumer<String> noValidation(); static String toString(String str); static String toString(String key, String value); static String toString(Map<String, String> propertyMap); static final String TABLE_SCHEMA_NAME; static final String TABLE_SCHEMA_TYPE; }