Package com.swiftmq.tools.prop
Class StructuredProperties
- java.lang.Object
-
- com.swiftmq.tools.prop.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 propertiesjava.lang.String[]
getSectionElements(java.lang.String sectionPrefix)
Returns all section elements for the given sectionjava.lang.String[]
getSections()
Returns an array with all defined sectionsjava.lang.String
getValue(java.lang.String sectionPrefix, java.lang.String sectionElement, java.lang.String propertyName)
Returns a property value
Example:
Is the property nameima.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
-
-
-
Field Detail
-
SECTION_QUALIFIER
public static final java.lang.String SECTION_QUALIFIER
- See Also:
- Constant Field Values
-
-
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 nameima.telegram.fiapas.content
, we get the value with
getValue("ima.telegram","fiapas","content");
- Parameters:
sectionPrefix
- SectionPrefixsectionElement
- Name of the SectionElementpropertyName
- Name of the Property
-
-