Class ConfigUtils


  • public class ConfigUtils
    extends java.lang.Object
    ConfigUtils
    Author:
    ddle.2015
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PROPERTIES_FILE  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigUtils()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug()  
      java.util.List<java.lang.String> getAllKeyWithPrefix​(java.lang.String prefix)  
      byte getByteProperty​(java.lang.String propName, byte defaultValue)
      Gets a property and converts it into byte.
      double getDoubleProperty​(java.lang.String propName, double defaultValue)
      Gets a property and converts it into double.
      static ConfigUtils getInstance()  
      int getIntProperty​(java.lang.String propName, int defaultValue)
      Gets a property and converts it into integer.
      java.lang.String getStringProperty​(java.lang.String propName)  
      java.lang.String getStringProperty​(java.lang.String propName, java.lang.String defaultValue)  
      void loadProperties​(java.lang.String fName)  
      • Methods inherited from class java.lang.Object

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

    • Constructor Detail

      • ConfigUtils

        public ConfigUtils()
    • Method Detail

      • getInstance

        public static ConfigUtils getInstance()
      • loadProperties

        public void loadProperties​(java.lang.String fName)
        Parameters:
        fName - File name
      • getAllKeyWithPrefix

        public java.util.List<java.lang.String> getAllKeyWithPrefix​(java.lang.String prefix)
        Parameters:
        prefix -
        Returns:
        all keys with prefix
      • getStringProperty

        public java.lang.String getStringProperty​(java.lang.String propName)
        Parameters:
        propName -
        Returns:
      • getStringProperty

        public java.lang.String getStringProperty​(java.lang.String propName,
                                                  java.lang.String defaultValue)
        Parameters:
        propName -
        defaultValue -
        Returns:
      • getByteProperty

        public byte getByteProperty​(java.lang.String propName,
                                    byte defaultValue)
        Gets a property and converts it into byte.
      • getIntProperty

        public int getIntProperty​(java.lang.String propName,
                                  int defaultValue)
        Gets a property and converts it into integer.
      • getDoubleProperty

        public double getDoubleProperty​(java.lang.String propName,
                                        double defaultValue)
        Gets a property and converts it into double.
      • debug

        public void debug()