Class SystemProperties

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,​java.lang.Object>

    public final class SystemProperties
    extends java.util.Properties
    This class overrides the system properties default implementation adding some default values and properties definitions for the service-oriented platforms works.
    Author:
    javaito
    See Also:
    Serialized Form
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String get​(java.lang.String propertyName)
      This method return the string value of the system property named like the parameter.
      static java.lang.String get​(java.lang.String propertyName, PropertyValueValidator<java.lang.String> validator)
      This method return the string value of the system property named like the parameter.
      static java.lang.Boolean getBoolean​(java.lang.String propertyName)
      This method return the value of the system property as boolean.
      static <O> java.lang.Class<O> getClass​(java.lang.String propertyName)
      This method return the value of the system property as class.
      static java.text.SimpleDateFormat getDateFormat​(java.lang.String propertyName)
      This method return the value of the property as a SimpleDateFormat instance.
      static java.text.DecimalFormat getDecimalFormat​(java.lang.String propertyName)
      This method return the value of the property as a DecimalFormat instnace.
      static java.lang.String getDefaultCharset()
      Return the default charset of the JVM instance.
      static java.lang.Double getDouble​(java.lang.String propertyName)
      This method return the value of the system property as double.
      static java.lang.Integer getInteger​(java.lang.String propertyName)
      This method return the value of the system property as integer.
      static java.util.List<java.lang.String> getList​(java.lang.String propertyName)
      This method return the value of the property as instance of list.
      static java.util.Locale getLocale()
      This method return the valuo of the property called 'hcjf.default.locale' as a locale instance.
      static java.util.Locale getLocale​(java.lang.String propertyName)
      This method return the value of the property as Locale instance.
      static java.lang.Long getLong​(java.lang.String propertyName)
      This method return the value of the system property as long.
      static java.util.Map<java.lang.String,​java.lang.String> getMap​(java.lang.String propertyName)
      This method return the value of the property as instance of map.
      static <O> O getObject​(java.lang.String propertyName, java.lang.Class<O> objectType)
      Returns the implementation object expected for the specific object type.
      static <O> java.util.List<O> getObjects​(java.lang.String propertyName, java.lang.Class<O> objectType)
      Returns a list of expected object instances for the specific object type.
      static java.nio.file.Path getPath​(java.lang.String propertyName)
      This method return the value of the system property as Path instance.
      static java.util.regex.Pattern getPattern​(java.lang.String propertyName)  
      static java.util.regex.Pattern getPattern​(java.lang.String propertyName, int flags)
      Return the compiled pattern from the property value.
      static java.util.Set<java.lang.String> getSet​(java.lang.String propertyName)
      This method return the value of the property as instance of set.
      static java.util.UUID getUUID​(java.lang.String propertyName)
      This method return the value of the system property as UUID instance.
      static void putDefaultValue​(java.lang.String propertyName, java.lang.String defaultValue)
      Put the default value for a property.
      java.lang.Object setProperty​(java.lang.String key, java.lang.String value)
      Calls the Hashtable method put.
      • Methods inherited from class java.util.Properties

        clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • HCJF_DEFAULT_DATE_FORMAT

        public static final java.lang.String HCJF_DEFAULT_DATE_FORMAT
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_NUMBER_FORMAT

        public static final java.lang.String HCJF_DEFAULT_NUMBER_FORMAT
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_SCIENTIFIC_NUMBER_FORMAT

        public static final java.lang.String HCJF_DEFAULT_SCIENTIFIC_NUMBER_FORMAT
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_DECIMAL_SEPARATOR

        public static final java.lang.String HCJF_DEFAULT_DECIMAL_SEPARATOR
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_GROUPING_SEPARATOR

        public static final java.lang.String HCJF_DEFAULT_GROUPING_SEPARATOR
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_PROPERTIES_FILE_PATH

        public static final java.lang.String HCJF_DEFAULT_PROPERTIES_FILE_PATH
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_PROPERTIES_FILE_XML

        public static final java.lang.String HCJF_DEFAULT_PROPERTIES_FILE_XML
        See Also:
        Constant Field Values
      • HCJF_INTEGER_NUMBER_REGEX

        public static final java.lang.String HCJF_INTEGER_NUMBER_REGEX
        See Also:
        Constant Field Values
      • HCJF_DECIMAL_NUMBER_REGEX

        public static final java.lang.String HCJF_DECIMAL_NUMBER_REGEX
        See Also:
        Constant Field Values
      • HCJF_SCIENTIFIC_NUMBER_REGEX

        public static final java.lang.String HCJF_SCIENTIFIC_NUMBER_REGEX
        See Also:
        Constant Field Values
      • HCJF_MATH_REGULAR_EXPRESSION

        public static final java.lang.String HCJF_MATH_REGULAR_EXPRESSION
        See Also:
        Constant Field Values
      • HCJF_MATH_CONNECTOR_REGULAR_EXPRESSION

        public static final java.lang.String HCJF_MATH_CONNECTOR_REGULAR_EXPRESSION
        See Also:
        Constant Field Values
      • HCJF_MATH_SPLITTER_REGULAR_EXPRESSION

        public static final java.lang.String HCJF_MATH_SPLITTER_REGULAR_EXPRESSION
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_LRU_MAP_SIZE

        public static final java.lang.String HCJF_DEFAULT_LRU_MAP_SIZE
        See Also:
        Constant Field Values
      • HCJF_DEFAULT_EXCEPTION_MESSAGE_TAG

        public static final java.lang.String HCJF_DEFAULT_EXCEPTION_MESSAGE_TAG
        See Also:
        Constant Field Values
    • Method Detail

      • putDefaultValue

        public static void putDefaultValue​(java.lang.String propertyName,
                                           java.lang.String defaultValue)
        Put the default value for a property.
        Parameters:
        propertyName - Property name.
        defaultValue - Property default value.
        Throws:
        java.lang.NullPointerException - Throw a NullPointerException when the property name or default value are null.
      • setProperty

        public java.lang.Object setProperty​(java.lang.String key,
                                            java.lang.String value)
        Calls the Hashtable method put. Provided for parallelism with the getProperty method. Enforces use of strings for property keys and values. The value returned is the result of the Hashtable call to put.
        Overrides:
        setProperty in class java.util.Properties
        Parameters:
        key - the key to be placed into this property list.
        value - the value corresponding to key.
        Returns:
        the previous value of the specified key in this property list, or null if it did not have one.
        Since:
        1.2
        See Also:
        Properties.getProperty(java.lang.String)
      • get

        public static java.lang.String get​(java.lang.String propertyName,
                                           PropertyValueValidator<java.lang.String> validator)
        This method return the string value of the system property named like the parameter.
        Parameters:
        propertyName - Name of the find property.
        validator - Property validator.
        Returns:
        Return the value of the property or null if the property is no defined.
      • get

        public static java.lang.String get​(java.lang.String propertyName)
        This method return the string value of the system property named like the parameter.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Return the value of the property or null if the property is no defined.
      • getBoolean

        public static java.lang.Boolean getBoolean​(java.lang.String propertyName)
        This method return the value of the system property as boolean.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Value of the system property as boolean, or null if the property is not found.
      • getInteger

        public static java.lang.Integer getInteger​(java.lang.String propertyName)
        This method return the value of the system property as integer.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Value of the system property as integer, or null if the property is not found.
      • getLong

        public static java.lang.Long getLong​(java.lang.String propertyName)
        This method return the value of the system property as long.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Value of the system property as long, or null if the property is not found.
      • getDouble

        public static java.lang.Double getDouble​(java.lang.String propertyName)
        This method return the value of the system property as double.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Value of the system property as double, or null if the property is not found.
      • getUUID

        public static java.util.UUID getUUID​(java.lang.String propertyName)
        This method return the value of the system property as UUID instance.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Value of the system property as UUID instance, or null if the property is not found.
      • getPath

        public static java.nio.file.Path getPath​(java.lang.String propertyName)
        This method return the value of the system property as Path instance.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Value of the system property as Path instance, or null if the property is not found.
      • getClass

        public static <O> java.lang.Class<O> getClass​(java.lang.String propertyName)
        This method return the value of the system property as class.
        Type Parameters:
        O - Type of the class instance expected.
        Parameters:
        propertyName - Name of the find property.
        Returns:
        Class instance.
      • getDefaultCharset

        public static java.lang.String getDefaultCharset()
        Return the default charset of the JVM instance.
        Returns:
        Default charset.
      • getLocale

        public static java.util.Locale getLocale​(java.lang.String propertyName)
        This method return the value of the property as Locale instance. The instance returned will be stored on near cache and will be removed when the value of the property has been updated.
        Parameters:
        propertyName - Name of the property that contains locale representation.
        Returns:
        Locale instance.
      • getLocale

        public static java.util.Locale getLocale()
        This method return the valuo of the property called 'hcjf.default.locale' as a locale instance. The instance returned will be stored on near cache and will be removed when the value of the property has been updated.
        Returns:
        Locale instance.
      • getDecimalFormat

        public static java.text.DecimalFormat getDecimalFormat​(java.lang.String propertyName)
        This method return the value of the property as a DecimalFormat instnace. The instance returned will be stored on near cache and will be removed when the value of the property has been updated.
        Parameters:
        propertyName - Name of the property that contains decimal pattern.
        Returns:
        DecimalFormat instance.
      • getDateFormat

        public static java.text.SimpleDateFormat getDateFormat​(java.lang.String propertyName)
        This method return the value of the property as a SimpleDateFormat instance. The instance returned will be stored on near cache and will be removed when the value of the property has been updated.
        Parameters:
        propertyName - Name of the property that contains date representation.
        Returns:
        Simple date format instance.
      • getObject

        public static <O> O getObject​(java.lang.String propertyName,
                                      java.lang.Class<O> objectType)
        Returns the implementation object expected for the specific object type.
        Type Parameters:
        O - Expected object instance.
        Parameters:
        propertyName - Name of the property.
        objectType - Object type.
        Returns:
        Object instance.
      • getObjects

        public static <O> java.util.List<O> getObjects​(java.lang.String propertyName,
                                                       java.lang.Class<O> objectType)
        Returns a list of expected object instances for the specific object type.
        Type Parameters:
        O - Expected object instance.
        Parameters:
        propertyName - Name of the property.
        objectType - Object type.
        Returns:
        Object instances.
      • getList

        public static java.util.List<java.lang.String> getList​(java.lang.String propertyName)
        This method return the value of the property as instance of list.
        Parameters:
        propertyName - Name of the property that contains the json array representation.
        Returns:
        List instance.
      • getSet

        public static java.util.Set<java.lang.String> getSet​(java.lang.String propertyName)
        This method return the value of the property as instance of set.
        Parameters:
        propertyName - Name of the property that contains the json array representation.
        Returns:
        Set instance.
      • getMap

        public static java.util.Map<java.lang.String,​java.lang.String> getMap​(java.lang.String propertyName)
        This method return the value of the property as instance of map.
        Parameters:
        propertyName - The name of the property that contains the json object representation.
        Returns:
        Map instance.
      • getPattern

        public static java.util.regex.Pattern getPattern​(java.lang.String propertyName)
      • getPattern

        public static java.util.regex.Pattern getPattern​(java.lang.String propertyName,
                                                         int flags)
        Return the compiled pattern from the property value.
        Parameters:
        propertyName - Name of the property.
        flags - Regex flags.
        Returns:
        Compiled pattern.