Package ninja.utils

Class NinjaPropertiesImpl

    • Method Detail

      • get

        public String get​(String key)
        Description copied from interface: NinjaProperties
        Get a String property or null if it is not there...
        Specified by:
        get in interface NinjaProperties
        Returns:
        the property of null if not there
      • getOrDie

        public String getOrDie​(String key)
        Description copied from interface: NinjaProperties
        The "die" method forces this key to be set. Otherwise a runtime exception will be thrown.
        Specified by:
        getOrDie in interface NinjaProperties
        Returns:
        the String or a RuntimeException will be thrown.
      • getInteger

        public Integer getInteger​(String key)
        Description copied from interface: NinjaProperties
        Get a property as Integer of null if not there / or property no integer
        Specified by:
        getInteger in interface NinjaProperties
        Returns:
        the property or null if not there or property no integer
      • getIntegerOrDie

        public Integer getIntegerOrDie​(String key)
        Description copied from interface: NinjaProperties
        The "die" method forces this key to be set. Otherwise a runtime exception will be thrown.
        Specified by:
        getIntegerOrDie in interface NinjaProperties
        Returns:
        the Integer or a RuntimeException will be thrown.
      • getBooleanOrDie

        public Boolean getBooleanOrDie​(String key)
        Description copied from interface: NinjaProperties
        The "die" method forces this key to be set. Otherwise a runtime exception will be thrown.
        Specified by:
        getBooleanOrDie in interface NinjaProperties
        Returns:
        the boolean or a RuntimeException will be thrown.
      • setProperty

        public void setProperty​(String key,
                                String value)
      • bindProperties

        public void bindProperties​(com.google.inject.Binder binder)
      • isProd

        public boolean isProd()
        Description copied from interface: NinjaProperties
        Whether we are in prod mode
        Specified by:
        isProd in interface NinjaProperties
        Returns:
        True if we are in prod mode
      • isDev

        public boolean isDev()
        Description copied from interface: NinjaProperties
        Whether we are in dev mode
        Specified by:
        isDev in interface NinjaProperties
        Returns:
        True if we are in dev mode
      • isTest

        public boolean isTest()
        Description copied from interface: NinjaProperties
        Whether we are in test mode
        Specified by:
        isTest in interface NinjaProperties
        Returns:
        True if we are in test mode
      • getContextPath

        public String getContextPath()
        Get the context path on which the application is running That means: - when running on root the context path is empty - when running on context there is NEVER a trailing slash We conform to the following rules: Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string. As outlined by: http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getContextPath()
        Specified by:
        getContextPath in interface NinjaProperties
        Returns:
        the context-path with a leading "/" or "" if running on root
      • getStringArray

        public String[] getStringArray​(String key)
        Description copied from interface: NinjaProperties
        eg. key=myval1,myval2 Delimiter is a comma "," as outlined in the example above.
        Specified by:
        getStringArray in interface NinjaProperties
        Returns:
        an array containing the values of that key or null if not found.
      • getWithDefault

        public String getWithDefault​(String key,
                                     String defaultValue)
        Description copied from interface: NinjaProperties
        Get a String property or a default value when property cannot be found in any configuration file.
        Specified by:
        getWithDefault in interface NinjaProperties
        Parameters:
        key - the key used in the configuration file.
        defaultValue - Default value returned, when value cannot be found in configuration.
        Returns:
        the value of the key or the default value.
      • getIntegerWithDefault

        public Integer getIntegerWithDefault​(String key,
                                             Integer defaultValue)
        Description copied from interface: NinjaProperties
        Get a Integer property or a default value when property cannot be found in any configuration file.
        Specified by:
        getIntegerWithDefault in interface NinjaProperties
        Parameters:
        key - the key used in the configuration file.
        defaultValue - Default value returned, when value cannot be found in configuration.
        Returns:
        the value of the key or the default value.
      • getBooleanWithDefault

        public Boolean getBooleanWithDefault​(String key,
                                             Boolean defaultValue)
        Description copied from interface: NinjaProperties
        Get a Boolean property or a default value when property cannot be found in any configuration file.
        Specified by:
        getBooleanWithDefault in interface NinjaProperties
        Parameters:
        key - the key used in the configuration file.
        defaultValue - Default value returned, when value cannot be found in configuration.
        Returns:
        the value of the key or the default value.