Class PropertyUtil


  • public class PropertyUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.String> applySchemaChanges​(java.util.Map<java.lang.String,​java.lang.String> properties, java.util.List<java.lang.String> deletedColumns, java.util.Map<java.lang.String,​java.lang.String> renamedColumns, java.util.Set<java.lang.String> columnProperties)  
      static java.util.Map<java.lang.String,​java.lang.String> filterProperties​(java.util.Map<java.lang.String,​java.lang.String> properties, java.util.function.Predicate<java.lang.String> keyPredicate)
      Filter the properties map by the provided key predicate.
      static java.util.Map<java.lang.String,​java.lang.String> propertiesWithPrefix​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String prefix)
      Returns subset of provided map with keys matching the provided prefix.
      static boolean propertyAsBoolean​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property, boolean defaultValue)  
      static double propertyAsDouble​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property, double defaultValue)  
      static int propertyAsInt​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property, int defaultValue)  
      static long propertyAsLong​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property, long defaultValue)  
      static java.lang.Boolean propertyAsNullableBoolean​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property)  
      static java.lang.Integer propertyAsNullableInt​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property)  
      static java.lang.Long propertyAsNullableLong​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property)  
      static java.lang.String propertyAsString​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String property, java.lang.String defaultValue)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • propertyAsBoolean

        public static boolean propertyAsBoolean​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                java.lang.String property,
                                                boolean defaultValue)
      • propertyAsNullableBoolean

        public static java.lang.Boolean propertyAsNullableBoolean​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                                  java.lang.String property)
      • propertyAsDouble

        public static double propertyAsDouble​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                              java.lang.String property,
                                              double defaultValue)
      • propertyAsInt

        public static int propertyAsInt​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                        java.lang.String property,
                                        int defaultValue)
      • propertyAsNullableInt

        public static java.lang.Integer propertyAsNullableInt​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                              java.lang.String property)
      • propertyAsLong

        public static long propertyAsLong​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                          java.lang.String property,
                                          long defaultValue)
      • propertyAsNullableLong

        public static java.lang.Long propertyAsNullableLong​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                            java.lang.String property)
      • propertyAsString

        public static java.lang.String propertyAsString​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                        java.lang.String property,
                                                        java.lang.String defaultValue)
      • propertiesWithPrefix

        public static java.util.Map<java.lang.String,​java.lang.String> propertiesWithPrefix​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                                                                  java.lang.String prefix)
        Returns subset of provided map with keys matching the provided prefix. Matching is case-sensitive and the matching prefix is removed from the keys in returned map.
        Parameters:
        properties - input map
        prefix - prefix to choose keys from input map
        Returns:
        subset of input map with keys starting with provided prefix and prefix trimmed out
      • filterProperties

        public static java.util.Map<java.lang.String,​java.lang.String> filterProperties​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                                                              java.util.function.Predicate<java.lang.String> keyPredicate)
        Filter the properties map by the provided key predicate.
        Parameters:
        properties - input map
        keyPredicate - predicate to choose keys from input map
        Returns:
        subset of input map with keys satisfying the predicate
      • applySchemaChanges

        public static java.util.Map<java.lang.String,​java.lang.String> applySchemaChanges​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                                                                java.util.List<java.lang.String> deletedColumns,
                                                                                                java.util.Map<java.lang.String,​java.lang.String> renamedColumns,
                                                                                                java.util.Set<java.lang.String> columnProperties)