Class StructuredProperties


  • public class StructuredProperties
    extends java.lang.Object
    Access class for structured properties. The structure is builded by sections. A section is recognized if their property name ends with ".names". The part before the ".names" is called the "section prefix".

    Example:

    ima.comm.partner.names=partner1,partner2,partner3
    (Section prefix in this case is "ima.comm.partner")

    As value of the sectipn property a list of section elements could defined. The values are separated by comma.

    For every section element further properties could be defined. The names of that properties are a concatenation of the prefix followed by the name of the section element and the property name.

    Example:

    ima.comm.partner.partner1.host=www.iit.de
    ima.comm.partner.partner1.port=5000.

    Version:
    1.0
    Author:
    Andreas Mueller, IIT GmbH
    • Field Summary

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

      Constructors 
      Constructor Description
      StructuredProperties​(java.util.Properties baseProperties)
      Wraps StructuredProperties around Properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Properties getBaseProperties()
      Returns the base properties
      java.lang.String[] getSectionElements​(java.lang.String sectionPrefix)
      Returns all section elements for the given section
      java.lang.String[] getSections()
      Returns an array with all defined sections
      java.lang.String getValue​(java.lang.String sectionPrefix, java.lang.String sectionElement, java.lang.String propertyName)
      Returns a property value

      Example:
      Is the property name ima.telegram.fiapas.content, we get the value with
      getValue("ima.telegram","fiapas","content");
      boolean hasSection​(java.lang.String sectionPrefix)
      Checks if a section with that prefix is defined
      • Methods inherited from class java.lang.Object

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

      • SECTION_QUALIFIER

        public static final java.lang.String SECTION_QUALIFIER
        See Also:
        Constant Field Values
    • Constructor Detail

      • StructuredProperties

        public StructuredProperties​(java.util.Properties baseProperties)
        Wraps StructuredProperties around Properties.
        Parameters:
        baseProperties - Basis-Properties
    • Method Detail

      • getBaseProperties

        public java.util.Properties getBaseProperties()
        Returns the base properties
        Returns:
        base properties
      • getSections

        public java.lang.String[] getSections()
        Returns an array with all defined sections
        Returns:
        defined sections
      • hasSection

        public boolean hasSection​(java.lang.String sectionPrefix)
        Checks if a section with that prefix is defined
        Parameters:
        sectionPrefix - SectionPrefix
      • getSectionElements

        public java.lang.String[] getSectionElements​(java.lang.String sectionPrefix)
        Returns all section elements for the given section
        Parameters:
        sectionPrefix - SectionPrefix
        Returns:
        section elements
      • getValue

        public java.lang.String getValue​(java.lang.String sectionPrefix,
                                         java.lang.String sectionElement,
                                         java.lang.String propertyName)
        Returns a property value

        Example:
        Is the property name ima.telegram.fiapas.content, we get the value with
        getValue("ima.telegram","fiapas","content");
        Parameters:
        sectionPrefix - SectionPrefix
        sectionElement - Name of the SectionElement
        propertyName - Name of the Property