org.openbp.jaspira.propertybrowser.editor
Class EditorParameterParser

java.lang.Object
  extended by org.openbp.jaspira.propertybrowser.editor.EditorParameterParser

public class EditorParameterParser
extends java.lang.Object

A String parser that parses the parameter element value obtained from the editor property file. The parameters are sorted into their different identifiers through which they can be accessed as a key.

Author:
Erich Lauterbach

Constructor Summary
EditorParameterParser(PropertyEditor editor)
          Default Constructor
 
Method Summary
protected  void add(java.lang.String identifier, java.lang.String value)
          Adds a value with its corresponding identifier to the map.
static java.lang.String determineDisplayValue(java.lang.String parameterValue)
          Used to get the display value from a parameter string that contains more than one value, i.e. the parameter holds two value seperated by a pipe '|';
static java.lang.String determineInternalValue(java.lang.String parameterValue)
          Used to get the value from a parameter string that contains more than one value, i.e. the parameter holds two value seperated by a pipe '|';
 java.util.Iterator get(java.lang.String identifier)
          Gets the given parameter as an iterator of string values.
 java.lang.String getString(java.lang.String identifier)
          Gets the given parameter as string value.
 int numberOfEntries(java.lang.String identifier)
          Gets the number of values contained for an identifier.
protected  void parse(java.lang.String parameters)
          Parses the editor parameter string to populate the map with the values for each parameter identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorParameterParser

public EditorParameterParser(PropertyEditor editor)
Default Constructor

Parameters:
editor - Property editor that owns the parameters
Method Detail

get

public java.util.Iterator get(java.lang.String identifier)
Gets the given parameter as an iterator of string values. Use this method if there may be more than 1 parameter.

Parameters:
identifier - The parameter identifier
Returns:
The iterator (may be empty)

getString

public java.lang.String getString(java.lang.String identifier)
Gets the given parameter as string value. Use this method if there may be more only 1 parameter of this type. If several such parameters have been given, the first one will be returned.

Parameters:
identifier - The parameter identifier
Returns:
Parameter string or null if no such parameter has been given

determineDisplayValue

public static java.lang.String determineDisplayValue(java.lang.String parameterValue)
Used to get the display value from a parameter string that contains more than one value, i.e. the parameter holds two value seperated by a pipe '|';

Parameters:
parameterValue - The parameter value
Returns:
The display value (can be null)

determineInternalValue

public static java.lang.String determineInternalValue(java.lang.String parameterValue)
Used to get the value from a parameter string that contains more than one value, i.e. the parameter holds two value seperated by a pipe '|';

Parameters:
parameterValue - The parameter value
Returns:
The internal value (can be null)

numberOfEntries

public int numberOfEntries(java.lang.String identifier)
Gets the number of values contained for an identifier.

Parameters:
identifier - The parameter identifier
Returns:
The number of values maped to the specified identifier or -1 if the identifier does not exist.

add

protected void add(java.lang.String identifier,
                   java.lang.String value)
Adds a value with its corresponding identifier to the map. If specified identifier has not been added to the map before, then a new ArrayList containing the value is created and added to the map with the new identifier, else the value is added to the array list maped to the identifier.

Parameters:
identifier - The identifier for the value
value - The value to be added to the map

parse

protected void parse(java.lang.String parameters)
Parses the editor parameter string to populate the map with the values for each parameter identifier.

Parameters:
parameters - The editor parameter string to be parsed


Copyright © 2011. All Rights Reserved.