jpos.util
Class DefaultProperties.MultiProp

java.lang.Object
  |
  +--jpos.util.DefaultProperties.MultiProp
All Implemented Interfaces:
JposProperties.MultiProperty
Enclosing class:
DefaultProperties

class DefaultProperties.MultiProp
extends java.lang.Object
implements JposProperties.MultiProperty

Default implementation of the jpos.util.JposProperties interface Speficies an interface used for returning multi properties. That is properties that are named like .x where x = 0, 1, ...x

Since:
1.3 (Washington DC 2001 meeting)
Author:
E. Michael Maximilien (maxim@us.ibm.com)

Constructor Summary
(package private) DefaultProperties.MultiProp(java.lang.String s)
          Creates a DefaultMultiProp with base prop name passed
 
Method Summary
(package private)  void add(java.lang.String propName, java.lang.String propValue)
          Adds a new to this multi property
 java.lang.String getBasePropertyName()
           
 int getNumberOfProperties()
           
 java.util.Iterator getPropertyNames()
           
 java.lang.String getPropertyString(int i)
           
 java.lang.String getPropertyString(java.lang.String propName)
           
 java.util.Iterator getPropertyValues()
           
 java.util.Iterator getSortedPropertyNames()
           
 int propertyNumber(java.lang.String propName)
           
(package private)  java.lang.String remove(java.lang.String propName)
          Removes existing property by name propName.
(package private)  int validatePropName(java.lang.String propName)
          Validates that propName passed is valid for this multi-prop
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultProperties.MultiProp

DefaultProperties.MultiProp(java.lang.String s)
Creates a DefaultMultiProp with base prop name passed
Parameters:
s - the String base prop name
Method Detail

getBasePropertyName

public java.lang.String getBasePropertyName()
Specified by:
getBasePropertyName in interface JposProperties.MultiProperty
Returns:
the base property name for this multi-property that is the name w/o the number suffix

getPropertyNames

public java.util.Iterator getPropertyNames()
Specified by:
getPropertyNames in interface JposProperties.MultiProperty
Returns:
an iterator of the property names for this multi-property

getSortedPropertyNames

public java.util.Iterator getSortedPropertyNames()
Specified by:
getSortedPropertyNames in interface JposProperties.MultiProperty
Returns:
an iterator of the property names alphabetically sorted for this multi-property

getPropertyValues

public java.util.Iterator getPropertyValues()
Specified by:
getPropertyValues in interface JposProperties.MultiProperty
Returns:
an iterator of the property values for this multi-property

getPropertyString

public java.lang.String getPropertyString(java.lang.String propName)
Specified by:
getPropertyString in interface JposProperties.MultiProperty
Parameters:
propName - the full property name .x
Returns:
the value for this property from the full property name

getPropertyString

public java.lang.String getPropertyString(int i)
                                   throws java.lang.IllegalArgumentException
Specified by:
getPropertyString in interface JposProperties.MultiProperty
Parameters:
number - suffix for the property name
Returns:
the value for this property from the full property name
Throws:
java.lang.IllegalArgumentException - if the i negative

getNumberOfProperties

public int getNumberOfProperties()
Specified by:
getNumberOfProperties in interface JposProperties.MultiProperty
Returns:
the number of properties defined in this multi-property

propertyNumber

public int propertyNumber(java.lang.String propName)
                   throws java.lang.IllegalArgumentException
Specified by:
propertyNumber in interface JposProperties.MultiProperty
Parameters:
propName - the property name to get the number of
Returns:
the number of this property name that is for property .x returns x
Throws:
java.lang.IllegalArgumentException - if the property name does not follow the .x name pattern

validatePropName

int validatePropName(java.lang.String propName)
               throws java.lang.IllegalArgumentException
Validates that propName passed is valid for this multi-prop
Returns:
the number of this property
Throws:
java.lang.IllegalArgumentException - if propName is not valid

add

void add(java.lang.String propName,
         java.lang.String propValue)
   throws java.lang.IllegalArgumentException
Adds a new to this multi property
Parameters:
propName - the property name
propValue - the property value
Throws:
java.lang.IllegalArgumentException - if the propName does not match the base prop name

remove

java.lang.String remove(java.lang.String propName)
Removes existing property by name propName. If property does not exist does nothing
Parameters:
propName - the property name
Returns:
the propValue of the property removed or null if not found


This API and code belongs to the JavaPOS committee please see LISCENCE file for details