Class PropertyFile

java.lang.Object
io.deephaven.configuration.PropertyFile
Direct Known Subclasses:
Configuration

public class PropertyFile extends Object
  • Field Details

  • Constructor Details

    • PropertyFile

      public PropertyFile()
      Creates an empty PropertyFile
    • PropertyFile

      public PropertyFile(String filename, Logger log, boolean fatal)
      Create a PropertyFile and load properties from the given file.
      Parameters:
      filename - name of file to load properties from
      log - Logger for error/warning messages, or null if not logging
      fatal - If the file can't be read and fatal is true -> throw exception
  • Method Details

    • getProperties

      public Properties getProperties()
      Return the Properties object loaded by this property file.
      Returns:
      the Properties object.
    • getProperties

      public Properties getProperties(String prefix)
      Collect all of the properties in this property file that begin with a given prefix.
      Returns:
      a new Properties object containing the selected properties, with the prefix removed.
    • setProperty

      public String setProperty(String key, String value)
      Sets the value of a given property
      Parameters:
      key - an identifier for the property
      value - the value for the property
      Returns:
      the previous value of the property
    • getProperty

      @NotNull public @NotNull String getProperty(String propertyName)
      Gets the value of the given property, aborting if the value is not specified in the system config files. Note that it is by design that there is no overloaded method taking a default value. Rather than scattering default values through all the source files, all properties should be in one config file (as much as possible). Put default values in common.prop.
    • getChar

      public char getChar(String propertyName)
    • getInteger

      public int getInteger(String propertyName)
    • getPositiveInteger

      public int getPositiveInteger(String propertyName)
    • getShort

      public short getShort(String propertyName)
    • getLong

      public long getLong(String propertyName)
    • getDouble

      public double getDouble(String propertyName)
    • getBoolean

      public boolean getBoolean(String propertyName)
    • getBooleanWithDefault

      public boolean getBooleanWithDefault(String propertyName, boolean defaultValue)
    • getLongWithDefault

      public long getLongWithDefault(String propertyName, long defaultValue)
    • getShortWithDefault

      public short getShortWithDefault(String propertyName, short defaultValue)
    • getIntegerWithDefault

      public int getIntegerWithDefault(String propertyName, int defaultValue)
    • getPossibleIntegerWithDefault

      public int getPossibleIntegerWithDefault(int defaultValue, String... possiblePropertyNames)
    • getStringWithDefault

      public String getStringWithDefault(String propertyName, String defaultValue)
    • getPossibleStringWithDefault

      public String getPossibleStringWithDefault(String defaultValue, String... possiblePropertyNames)
    • getDoubleWithDefault

      public double getDoubleWithDefault(String propertyName, double defaultValue)
    • getBoolean

      public boolean getBoolean(String propertyName, Logger logger, String logPrefix)
    • getInteger

      public int getInteger(String propertyName, Logger logger, String logPrefix)
    • getShort

      public short getShort(String propertyName, Logger logger, String logPrefix)
    • getLong

      public long getLong(String propertyName, Logger logger, String logPrefix)
    • getDouble

      public double getDouble(String propertyName, Logger logger, String logPrefix)
    • getString

      public String getString(String propertyName, Logger logger, String logPrefix)
    • getBooleanForClass

      public boolean getBooleanForClass(Class c, String propertyLast)
    • getBooleanForClassWithDefault

      public boolean getBooleanForClassWithDefault(Class c, String propertyLast, boolean defaultValue)
    • getIntegerForClass

      public int getIntegerForClass(Class c, String propertyLast)
    • getIntegerForClassWithDefault

      public int getIntegerForClassWithDefault(Class c, String propertyLast, int defaultValue)
    • getShortForClass

      public long getShortForClass(Class c, String propertyLast)
    • getLongForClass

      public long getLongForClass(Class c, String propertyLast)
    • getLongForClassWithDefault

      public long getLongForClassWithDefault(Class c, String propertyLast, long defaultValue)
    • getDoubleForClass

      public double getDoubleForClass(Class c, String propertyLast)
    • getDoubleForClassWithDefault

      public double getDoubleForClassWithDefault(Class c, String propertyLast, double defaultValue)
    • getStringForClass

      public String getStringForClass(Class c, String propertyLast)
    • hasProperty

      public boolean hasProperty(String propertyName)
    • getStringForClassWithDefault

      public String getStringForClassWithDefault(Class c, String propertyLast, String defaultValue)
    • getIntHashSetForClass

      public gnu.trove.set.hash.TIntHashSet getIntHashSetForClass(Class c, String propertyLast)
    • getIntArrayForClass

      public int[] getIntArrayForClass(Class c, String propertyLast)
    • getClassParams

      public void getClassParams(Logger log, Class c, String instanceStr, Object obj, int desiredMods)
    • getClassParams

      public void getClassParams(Class c, Object obj)
    • getClassParams

      public void getClassParams(Logger log, Class c, Object obj)
    • getClassParams

      public void getClassParams(Logger log, Class c, String name, Object obj)
    • getIntHashSetFromProperty

      public gnu.trove.set.hash.TIntHashSet getIntHashSetFromProperty(String propertyName)
    • getStringSetFromProperty

      public Set<String> getStringSetFromProperty(String propertyName)
    • getStringSetFromPropertyWithDefault

      public Set<String> getStringSetFromPropertyWithDefault(String propertyName, Set<String> defaultValue)
    • getStringArrayFromProperty

      public String[] getStringArrayFromProperty(String propertyName)
    • getStringArrayFromPropertyWithDefault

      public String[] getStringArrayFromPropertyWithDefault(String propertyName, String[] defaultValue)
    • getStringSetFromPropertyForClass

      public Set<String> getStringSetFromPropertyForClass(Class c, String propertyLast)
    • getNameStringSetFromProperty

      public Set<String> getNameStringSetFromProperty(String propertyName)
    • getNameStringMapFromProperty

      public Map<String,String> getNameStringMapFromProperty(String propertyName)
    • getIntegerArray

      public int[] getIntegerArray(String propertyName)
    • getNonNegativeIntSetWithRangeSupport

      public gnu.trove.set.TIntSet getNonNegativeIntSetWithRangeSupport(String propertyName)
      Parse a set of non-negative ints from a property. Format is comma-separated individual values and ranges of the form start-end.
      Parameters:
      propertyName -
      Returns:
      A set of ints derived from the specified property.
    • getBitSet

      public BitSet getBitSet(String propertyName, int length)
    • getStringIntHashMap

      public gnu.trove.map.hash.TObjectIntHashMap<String> getStringIntHashMap(String propertyName, String separator)
    • getLongArray

      public long[] getLongArray(String propertyName)