Package org.jpos.core

Class SubConfiguration

  • All Implemented Interfaces:
    Configuration

    public class SubConfiguration
    extends java.lang.Object
    implements Configuration
    SubConfiguration objects lets childs objects access attributes in its parent object with a given prefix, for example "child.". Child objects can access properties with their prefix removed.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Configuration cfg
      Parent Configuration
      protected java.lang.String prefix
      prefix identifying the child parameters
    • Constructor Summary

      Constructors 
      Constructor Description
      SubConfiguration()
      Creates a new empty SubConfiguration object
      SubConfiguration​(Configuration cfg, java.lang.String prefix)
      Creates a new SubConfiguration from its parent's Configuration and the a given prefix.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String get​(java.lang.String propertyName)  
      java.lang.String get​(java.lang.String propertyName, java.lang.String defaultValue)  
      java.lang.String[] getAll​(java.lang.String propertyName)  
      boolean getBoolean​(java.lang.String propertyName)  
      boolean getBoolean​(java.lang.String propertyName, boolean defaultValue)  
      boolean[] getBooleans​(java.lang.String propertyName)  
      double getDouble​(java.lang.String propertyName)  
      double getDouble​(java.lang.String propertyName, double defaultValue)  
      double[] getDoubles​(java.lang.String propertyName)  
      int getInt​(java.lang.String propertyName)  
      int getInt​(java.lang.String propertyName, int defaultValue)  
      int[] getInts​(java.lang.String propertyName)  
      long getLong​(java.lang.String propertyName)  
      long getLong​(java.lang.String propertyName, long defaultValue)  
      long[] getLongs​(java.lang.String propertyName)  
      java.lang.Object getObject​(java.lang.String propertyName)
      Creates a new object, it takes the class from the value of the property propertyName
      java.util.Set<java.lang.String> keySet()  
      void put​(java.lang.String name, java.lang.Object value)  
      void setConfiguration​(Configuration newCfg)
      Sets the container configuration.
      void setPrefix​(java.lang.String newPrefix)
      Sets the prefix that identifies the parameters of the child object inside the parent configuration.
      • Methods inherited from class java.lang.Object

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

      • prefix

        protected java.lang.String prefix
        prefix identifying the child parameters
    • Constructor Detail

      • SubConfiguration

        public SubConfiguration()
        Creates a new empty SubConfiguration object
      • SubConfiguration

        public SubConfiguration​(Configuration cfg,
                                java.lang.String prefix)
        Creates a new SubConfiguration from its parent's Configuration and the a given prefix.
        Parameters:
        cfg - Parent's Configuration
        prefix - prefix identifying child parameters.
    • Method Detail

      • setConfiguration

        public void setConfiguration​(Configuration newCfg)
        Sets the container configuration.
        Parameters:
        newCfg - New container configuration.
      • setPrefix

        public void setPrefix​(java.lang.String newPrefix)
        Sets the prefix that identifies the parameters of the child object inside the parent configuration.
        Parameters:
        newPrefix - New prefix
      • get

        public java.lang.String get​(java.lang.String propertyName)
        Specified by:
        get in interface Configuration
      • getAll

        public java.lang.String[] getAll​(java.lang.String propertyName)
        Specified by:
        getAll in interface Configuration
        Parameters:
        propertyName - ditto
        Returns:
        all properties with a given name (or a zero-length array)
      • get

        public java.lang.String get​(java.lang.String propertyName,
                                    java.lang.String defaultValue)
        Specified by:
        get in interface Configuration
      • getLong

        public long getLong​(java.lang.String propertyName,
                            long defaultValue)
        Specified by:
        getLong in interface Configuration
      • getInt

        public int getInt​(java.lang.String propertyName,
                          int defaultValue)
        Specified by:
        getInt in interface Configuration
      • put

        public void put​(java.lang.String name,
                        java.lang.Object value)
        Specified by:
        put in interface Configuration
        Parameters:
        name - the Property name
        value - typically a String, but could be a String[] too
      • getObject

        public java.lang.Object getObject​(java.lang.String propertyName)
                                   throws ConfigurationException
        Creates a new object, it takes the class from the value of the property propertyName
        Parameters:
        propertyName - Property whose value is the class name of the object being created.
        Throws:
        ConfigurationException