Class ComponentConfiguration

  • All Implemented Interfaces:
    org.apache.commons.configuration2.Configuration, org.apache.commons.configuration2.ImmutableConfiguration, org.apache.commons.configuration2.sync.SynchronizerSupport
    Direct Known Subclasses:
    BookieConfiguration

    public abstract class ComponentConfiguration
    extends java.lang.Object
    implements org.apache.commons.configuration2.Configuration
    Component Configuration.
    • Field Summary

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

      Constructors 
      Modifier Constructor Description
      protected ComponentConfiguration​(org.apache.commons.configuration2.CompositeConfiguration underlyingConf, java.lang.String componentPrefix)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addProperty​(java.lang.String key, java.lang.Object value)  
      java.lang.String asJson()
      returns the string representation of json format of this config.
      void clear()  
      void clearProperty​(java.lang.String key)  
      boolean containsKey​(java.lang.String key)  
      <T> T get​(java.lang.Class<T> cls, java.lang.String key)  
      <T> T get​(java.lang.Class<T> cls, java.lang.String key, T defaultValue)  
      java.lang.Object getArray​(java.lang.Class<?> cls, java.lang.String key)  
      java.lang.Object getArray​(java.lang.Class<?> cls, java.lang.String key, java.lang.Object defaultValue)
      Deprecated.
      java.math.BigDecimal getBigDecimal​(java.lang.String key)  
      java.math.BigDecimal getBigDecimal​(java.lang.String key, java.math.BigDecimal defaultValue)  
      java.math.BigInteger getBigInteger​(java.lang.String key)  
      java.math.BigInteger getBigInteger​(java.lang.String key, java.math.BigInteger defaultValue)  
      boolean getBoolean​(java.lang.String key)  
      boolean getBoolean​(java.lang.String key, boolean defaultValue)  
      java.lang.Boolean getBoolean​(java.lang.String key, java.lang.Boolean defaultValue)  
      byte getByte​(java.lang.String key)  
      byte getByte​(java.lang.String key, byte defaultValue)  
      java.lang.Byte getByte​(java.lang.String key, java.lang.Byte defaultValue)  
      <T> java.util.Collection<T> getCollection​(java.lang.Class<T> cls, java.lang.String key, java.util.Collection<T> target)  
      <T> java.util.Collection<T> getCollection​(java.lang.Class<T> cls, java.lang.String key, java.util.Collection<T> target, java.util.Collection<T> defaultValue)  
      double getDouble​(java.lang.String key)  
      double getDouble​(java.lang.String key, double defaultValue)  
      java.lang.Double getDouble​(java.lang.String key, java.lang.Double defaultValue)  
      java.time.Duration getDuration​(java.lang.String key)  
      java.time.Duration getDuration​(java.lang.String key, java.time.Duration defaultValue)  
      java.lang.String getEncodedString​(java.lang.String key)  
      java.lang.String getEncodedString​(java.lang.String key, org.apache.commons.configuration2.ConfigurationDecoder decoder)  
      <T extends java.lang.Enum<T>>
      T
      getEnum​(java.lang.String key, java.lang.Class<T> enumType)  
      <T extends java.lang.Enum<T>>
      T
      getEnum​(java.lang.String key, java.lang.Class<T> enumType, T defaultValue)  
      float getFloat​(java.lang.String key)  
      float getFloat​(java.lang.String key, float defaultValue)  
      java.lang.Float getFloat​(java.lang.String key, java.lang.Float defaultValue)  
      int getInt​(java.lang.String key)  
      int getInt​(java.lang.String key, int defaultValue)  
      java.lang.Integer getInteger​(java.lang.String key, java.lang.Integer defaultValue)  
      org.apache.commons.configuration2.interpol.ConfigurationInterpolator getInterpolator()  
      protected java.lang.String getKeyName​(java.lang.String name)  
      java.util.Iterator<java.lang.String> getKeys()  
      java.util.Iterator<java.lang.String> getKeys​(java.lang.String prefix)  
      java.util.Iterator<java.lang.String> getKeys​(java.lang.String prefix, java.lang.String delimiter)  
      <T> java.util.List<T> getList​(java.lang.Class<T> cls, java.lang.String key)  
      <T> java.util.List<T> getList​(java.lang.Class<T> cls, java.lang.String key, java.util.List<T> defaultValue)  
      java.util.List<java.lang.Object> getList​(java.lang.String key)  
      java.util.List<java.lang.Object> getList​(java.lang.String key, java.util.List<?> defaultValue)  
      long getLong​(java.lang.String key)  
      long getLong​(java.lang.String key, long defaultValue)  
      java.lang.Long getLong​(java.lang.String key, java.lang.Long defaultValue)  
      java.util.Properties getProperties​(java.lang.String key)  
      java.lang.Object getProperty​(java.lang.String key)  
      short getShort​(java.lang.String key)  
      short getShort​(java.lang.String key, short defaultValue)  
      java.lang.Short getShort​(java.lang.String key, java.lang.Short defaultValue)  
      java.lang.String getString​(java.lang.String key)  
      java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)  
      java.lang.String[] getStringArray​(java.lang.String key)  
      org.apache.commons.configuration2.sync.Synchronizer getSynchronizer()  
      org.apache.commons.configuration2.CompositeConfiguration getUnderlyingConf()  
      org.apache.commons.configuration2.ImmutableConfiguration immutableSubset​(java.lang.String prefix)  
      void installInterpolator​(java.util.Map<java.lang.String,​? extends org.apache.commons.configuration2.interpol.Lookup> prefixLookups, java.util.Collection<? extends org.apache.commons.configuration2.interpol.Lookup> defLookups)  
      boolean isEmpty()  
      void loadConf​(java.net.URL confURL)
      Load configuration from a given confURL.
      protected void loadConf​(org.apache.commons.configuration2.Configuration loadedConf)  
      void lock​(org.apache.commons.configuration2.sync.LockMode mode)  
      void setInterpolator​(org.apache.commons.configuration2.interpol.ConfigurationInterpolator ci)  
      void setProperty​(java.lang.String key, java.lang.Object value)  
      void setSynchronizer​(org.apache.commons.configuration2.sync.Synchronizer sync)  
      int size()  
      org.apache.commons.configuration2.Configuration subset​(java.lang.String prefix)  
      void unlock​(org.apache.commons.configuration2.sync.LockMode mode)  
      void validate()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.commons.configuration2.ImmutableConfiguration

        containsValue
    • Constructor Detail

      • ComponentConfiguration

        protected ComponentConfiguration​(org.apache.commons.configuration2.CompositeConfiguration underlyingConf,
                                         java.lang.String componentPrefix)
    • Method Detail

      • getKeyName

        protected java.lang.String getKeyName​(java.lang.String name)
      • getUnderlyingConf

        public org.apache.commons.configuration2.CompositeConfiguration getUnderlyingConf()
      • loadConf

        public void loadConf​(java.net.URL confURL)
                      throws org.apache.commons.configuration2.ex.ConfigurationException
        Load configuration from a given confURL.
        Parameters:
        confURL - the url points to the configuration.
        Throws:
        org.apache.commons.configuration2.ex.ConfigurationException - when failed to load configuration.
      • loadConf

        protected void loadConf​(org.apache.commons.configuration2.Configuration loadedConf)
      • validate

        public void validate()
                      throws org.apache.commons.configuration2.ex.ConfigurationException
        Throws:
        org.apache.commons.configuration2.ex.ConfigurationException
      • subset

        public org.apache.commons.configuration2.Configuration subset​(java.lang.String prefix)
        Specified by:
        subset in interface org.apache.commons.configuration2.Configuration
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface org.apache.commons.configuration2.ImmutableConfiguration
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Specified by:
        containsKey in interface org.apache.commons.configuration2.ImmutableConfiguration
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.Object value)
        Specified by:
        addProperty in interface org.apache.commons.configuration2.Configuration
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.Object value)
        Specified by:
        setProperty in interface org.apache.commons.configuration2.Configuration
      • clearProperty

        public void clearProperty​(java.lang.String key)
        Specified by:
        clearProperty in interface org.apache.commons.configuration2.Configuration
      • clear

        public void clear()
        Specified by:
        clear in interface org.apache.commons.configuration2.Configuration
      • getProperty

        public java.lang.Object getProperty​(java.lang.String key)
        Specified by:
        getProperty in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getKeys

        public java.util.Iterator<java.lang.String> getKeys​(java.lang.String prefix)
        Specified by:
        getKeys in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getKeys

        public java.util.Iterator<java.lang.String> getKeys()
        Specified by:
        getKeys in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getProperties

        public java.util.Properties getProperties​(java.lang.String key)
        Specified by:
        getProperties in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBoolean

        public boolean getBoolean​(java.lang.String key)
        Specified by:
        getBoolean in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBoolean

        public boolean getBoolean​(java.lang.String key,
                                  boolean defaultValue)
        Specified by:
        getBoolean in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBoolean

        public java.lang.Boolean getBoolean​(java.lang.String key,
                                            java.lang.Boolean defaultValue)
        Specified by:
        getBoolean in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getByte

        public byte getByte​(java.lang.String key)
        Specified by:
        getByte in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getByte

        public byte getByte​(java.lang.String key,
                            byte defaultValue)
        Specified by:
        getByte in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getByte

        public java.lang.Byte getByte​(java.lang.String key,
                                      java.lang.Byte defaultValue)
        Specified by:
        getByte in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getDouble

        public double getDouble​(java.lang.String key)
        Specified by:
        getDouble in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getDouble

        public double getDouble​(java.lang.String key,
                                double defaultValue)
        Specified by:
        getDouble in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getDouble

        public java.lang.Double getDouble​(java.lang.String key,
                                          java.lang.Double defaultValue)
        Specified by:
        getDouble in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getFloat

        public float getFloat​(java.lang.String key)
        Specified by:
        getFloat in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getFloat

        public float getFloat​(java.lang.String key,
                              float defaultValue)
        Specified by:
        getFloat in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getFloat

        public java.lang.Float getFloat​(java.lang.String key,
                                        java.lang.Float defaultValue)
        Specified by:
        getFloat in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getInt

        public int getInt​(java.lang.String key)
        Specified by:
        getInt in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getInt

        public int getInt​(java.lang.String key,
                          int defaultValue)
        Specified by:
        getInt in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getInteger

        public java.lang.Integer getInteger​(java.lang.String key,
                                            java.lang.Integer defaultValue)
        Specified by:
        getInteger in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getLong

        public long getLong​(java.lang.String key)
        Specified by:
        getLong in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getLong

        public long getLong​(java.lang.String key,
                            long defaultValue)
        Specified by:
        getLong in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getLong

        public java.lang.Long getLong​(java.lang.String key,
                                      java.lang.Long defaultValue)
        Specified by:
        getLong in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getShort

        public short getShort​(java.lang.String key)
        Specified by:
        getShort in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getShort

        public short getShort​(java.lang.String key,
                              short defaultValue)
        Specified by:
        getShort in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getShort

        public java.lang.Short getShort​(java.lang.String key,
                                        java.lang.Short defaultValue)
        Specified by:
        getShort in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBigDecimal

        public java.math.BigDecimal getBigDecimal​(java.lang.String key)
        Specified by:
        getBigDecimal in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBigDecimal

        public java.math.BigDecimal getBigDecimal​(java.lang.String key,
                                                  java.math.BigDecimal defaultValue)
        Specified by:
        getBigDecimal in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBigInteger

        public java.math.BigInteger getBigInteger​(java.lang.String key)
        Specified by:
        getBigInteger in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getBigInteger

        public java.math.BigInteger getBigInteger​(java.lang.String key,
                                                  java.math.BigInteger defaultValue)
        Specified by:
        getBigInteger in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getString

        public java.lang.String getString​(java.lang.String key)
        Specified by:
        getString in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.String defaultValue)
        Specified by:
        getString in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getStringArray

        public java.lang.String[] getStringArray​(java.lang.String key)
        Specified by:
        getStringArray in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getList

        public java.util.List<java.lang.Object> getList​(java.lang.String key)
        Specified by:
        getList in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getList

        public java.util.List<java.lang.Object> getList​(java.lang.String key,
                                                        java.util.List<?> defaultValue)
        Specified by:
        getList in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getInterpolator

        public org.apache.commons.configuration2.interpol.ConfigurationInterpolator getInterpolator()
        Specified by:
        getInterpolator in interface org.apache.commons.configuration2.Configuration
      • installInterpolator

        public void installInterpolator​(java.util.Map<java.lang.String,​? extends org.apache.commons.configuration2.interpol.Lookup> prefixLookups,
                                        java.util.Collection<? extends org.apache.commons.configuration2.interpol.Lookup> defLookups)
        Specified by:
        installInterpolator in interface org.apache.commons.configuration2.Configuration
      • setInterpolator

        public void setInterpolator​(org.apache.commons.configuration2.interpol.ConfigurationInterpolator ci)
        Specified by:
        setInterpolator in interface org.apache.commons.configuration2.Configuration
      • get

        public <T> T get​(java.lang.Class<T> cls,
                         java.lang.String key)
        Specified by:
        get in interface org.apache.commons.configuration2.ImmutableConfiguration
      • get

        public <T> T get​(java.lang.Class<T> cls,
                         java.lang.String key,
                         T defaultValue)
        Specified by:
        get in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getArray

        public java.lang.Object getArray​(java.lang.Class<?> cls,
                                         java.lang.String key)
        Specified by:
        getArray in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getArray

        @Deprecated
        public java.lang.Object getArray​(java.lang.Class<?> cls,
                                         java.lang.String key,
                                         java.lang.Object defaultValue)
        Deprecated.
        Specified by:
        getArray in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getCollection

        public <T> java.util.Collection<T> getCollection​(java.lang.Class<T> cls,
                                                         java.lang.String key,
                                                         java.util.Collection<T> target)
        Specified by:
        getCollection in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getCollection

        public <T> java.util.Collection<T> getCollection​(java.lang.Class<T> cls,
                                                         java.lang.String key,
                                                         java.util.Collection<T> target,
                                                         java.util.Collection<T> defaultValue)
        Specified by:
        getCollection in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getDuration

        public java.time.Duration getDuration​(java.lang.String key)
        Specified by:
        getDuration in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getDuration

        public java.time.Duration getDuration​(java.lang.String key,
                                              java.time.Duration defaultValue)
        Specified by:
        getDuration in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getEncodedString

        public java.lang.String getEncodedString​(java.lang.String key)
        Specified by:
        getEncodedString in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getEncodedString

        public java.lang.String getEncodedString​(java.lang.String key,
                                                 org.apache.commons.configuration2.ConfigurationDecoder decoder)
        Specified by:
        getEncodedString in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getEnum

        public <T extends java.lang.Enum<T>> T getEnum​(java.lang.String key,
                                                       java.lang.Class<T> enumType)
        Specified by:
        getEnum in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getEnum

        public <T extends java.lang.Enum<T>> T getEnum​(java.lang.String key,
                                                       java.lang.Class<T> enumType,
                                                       T defaultValue)
        Specified by:
        getEnum in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getKeys

        public java.util.Iterator<java.lang.String> getKeys​(java.lang.String prefix,
                                                            java.lang.String delimiter)
        Specified by:
        getKeys in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getList

        public <T> java.util.List<T> getList​(java.lang.Class<T> cls,
                                             java.lang.String key)
        Specified by:
        getList in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getList

        public <T> java.util.List<T> getList​(java.lang.Class<T> cls,
                                             java.lang.String key,
                                             java.util.List<T> defaultValue)
        Specified by:
        getList in interface org.apache.commons.configuration2.ImmutableConfiguration
      • immutableSubset

        public org.apache.commons.configuration2.ImmutableConfiguration immutableSubset​(java.lang.String prefix)
        Specified by:
        immutableSubset in interface org.apache.commons.configuration2.ImmutableConfiguration
      • size

        public int size()
        Specified by:
        size in interface org.apache.commons.configuration2.ImmutableConfiguration
      • getSynchronizer

        public org.apache.commons.configuration2.sync.Synchronizer getSynchronizer()
        Specified by:
        getSynchronizer in interface org.apache.commons.configuration2.sync.SynchronizerSupport
      • lock

        public void lock​(org.apache.commons.configuration2.sync.LockMode mode)
        Specified by:
        lock in interface org.apache.commons.configuration2.sync.SynchronizerSupport
      • setSynchronizer

        public void setSynchronizer​(org.apache.commons.configuration2.sync.Synchronizer sync)
        Specified by:
        setSynchronizer in interface org.apache.commons.configuration2.sync.SynchronizerSupport
      • unlock

        public void unlock​(org.apache.commons.configuration2.sync.LockMode mode)
        Specified by:
        unlock in interface org.apache.commons.configuration2.sync.SynchronizerSupport
      • asJson

        public java.lang.String asJson()
        returns the string representation of json format of this config.
        Returns:
        Throws:
        JsonUtil.ParseJsonException