Package 

Class AbstractConfiguration


  • 
    public abstract class AbstractConfiguration
    
                        

    Created by vincent on 17-1-17. Copyright @ 2013-2017 Platon AI. All rights reserved

    • Method Detail

      • getEnvironment

         final Environment getEnvironment()

        Spring core is the first class dependency now, we will remove dependency on KConfiguration later

      • setEnvironment

         final Unit setEnvironment(Environment environment)

        Spring core is the first class dependency now, we will remove dependency on KConfiguration later

      • get

         String get(String name)

        Get the value of the name property, null if no such property exists. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null.

        Values are processed for #VariableExpansion before being returned.

        Parameters:
        name - the property name, will be trimmed before get value.
      • get

         String get(String name, String defaultValue)

        Get the value of the name. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. If no such property exists, then defaultValue is returned.

        Parameters:
        name - property name, will be trimmed before get value.
        defaultValue - default value.
      • getInt

         final Integer getInt(String name, Integer defaultValue)

        Get the value of the name property as an int.

        If no such property exists, the provided default value is returned, or if the specified value is not a valid int, then an error is thrown.

        Parameters:
        name - property name.
        defaultValue - default value.
      • getInts

         final IntArray getInts(String name)

        Get the value of the name property as a set of comma-delimited int values.

        If no such property exists, an empty array is returned.

        Parameters:
        name - property name
      • getLong

         final Long getLong(String name, Long defaultValue)

        Get the value of the name property as a long. If no such property exists, the provided default value is returned, or if the specified value is not a valid long, then an error is thrown.

        Parameters:
        name - property name.
        defaultValue - default value.
      • getFloat

         final Float getFloat(String name, Float defaultValue)

        Get the value of the name property as a float. If no such property exists, the provided default value is returned, or if the specified value is not a valid float, then an error is thrown.

        Parameters:
        name - property name.
        defaultValue - default value.
      • getDouble

         final Double getDouble(String name, Double defaultValue)

        Get the value of the name property as a double. If no such property exists, the provided default value is returned, or if the specified value is not a valid double, then an error is thrown.

        Parameters:
        name - property name.
        defaultValue - default value.
      • getBoolean

         final Boolean getBoolean(String name, Boolean defaultValue)

        Get the value of the name property as a boolean. If no such property is specified, or if the specified value is not a valid boolean, then defaultValue is returned.

        Parameters:
        name - property name.
        defaultValue - default value.
      • getEnum

         final <T extends Enum<T>> T getEnum(String name, T defaultValue)

        Return value matching this enumerated type.

        Parameters:
        name - Property name
        defaultValue - Value returned if no mapping exists
      • getStringCollection

         final Collection<String> getStringCollection(String name)

        Get the comma delimited values of the name property as a collection of Strings. If no such property is specified then empty collection is returned.

        This is an optimized version of .getStrings

        Parameters:
        name - property name.
      • getStrings

         final Array<String> getStrings(String name)

        Get the comma delimited values of the name property as an array of Strings. If no such property is specified then null is returned.

        Parameters:
        name - property name.
      • getStrings

         final Array<String> getStrings(String name, String defaultValue)

        Get the comma delimited values of the name property as an array of Strings. If no such property is specified then default value is returned.

        Parameters:
        name - property name.
        defaultValue - The default value
      • getTrimmedStringCollection

         final Collection<String> getTrimmedStringCollection(String name)

        Get the comma delimited values of the name property as a collection of Strings, trimmed of the leading and trailing whitespace. If no such property is specified then empty Collection is returned.

        Parameters:
        name - property name.
      • getTrimmedStrings

         final Array<String> getTrimmedStrings(String name)

        Get the comma delimited values of the name property as an array of Strings, trimmed of the leading and trailing whitespace. If no such property is specified then an empty array is returned.

        Parameters:
        name - property name.
      • getTrimmedStrings

         final Array<String> getTrimmedStrings(String name, String defaultValue)

        Get the comma delimited values of the name property as an array of Strings, trimmed of the leading and trailing whitespace. If no such property is specified then default value is returned.

        Parameters:
        name - property name.
        defaultValue - The default value
      • getUint

         final Integer getUint(String name, Integer defaultValue)

        Get an unsigned integer, if the configured value is negative or not set, return the default value

        Parameters:
        name - The property name
        defaultValue - The default value return if the configured value is negative
      • getUlong

         final Long getUlong(String name, Long defaultValue)

        Get a unsigned long integer, if the configured value is negative, return the default value

        Parameters:
        name - The property name
        defaultValue - The default value return if the configured value is negative
      • getDuration

         final Duration getDuration(String name)

        Support both ISO-8601 standard and hadoop time duration format ISO-8601 standard : PnDTnHnMn.nS Hadoop time duration format : Valid units are : ns, us, ms, s, m, h, d.

        Parameters:
        name - a java.lang.String object.
      • getClass

         final Class<?> getClass(String name, Class<?> defaultValue)

        Get the value of the name property as a Class. If no such property is specified, then defaultValue is returned.

        Parameters:
        name - the class name.
        defaultValue - default value.
      • getClass

         final <U extends Any> Class<out U> getClass(String name, Class<out U> defaultValue, Class<U> xface)

        Get the value of the name property as a Class implementing the interface specified by xface.

        If no such property is specified, then defaultValue is returned.

        An exception is thrown if the returned class does not implement the named interface.

        Parameters:
        name - the class name.
        defaultValue - default value.
        xface - the interface implemented by the named class.