EchoPoint
1.0

echopoint.template
Class SimpleTextSubstitution

java.lang.Object
  extended byechopoint.template.SimpleTextSubstitution
All Implemented Interfaces:
java.io.Serializable, TextSubstitution

public class SimpleTextSubstitution
extends java.lang.Object
implements TextSubstitution

The class SimpleTextSubstitution is a simple implementation of TextSubstitution that uses a HashMap to substitute named string values.

Note it uses the toString() method rather than casting associated value objects to Strings and hence you can technically use objects other than Strings.

See Also:
Serialized Form

Constructor Summary
SimpleTextSubstitution()
          SimpleTextSubstitution constructor that creates its own empty HashMap.
SimpleTextSubstitution(java.util.HashMap newStringMap)
          SimpleTextSubstitution constructor that takes a primed HashMap of string mappings.
 
Method Summary
 java.util.HashMap getStringMap()
          Returns the underlying HashMap containing named string.
 java.lang.String getSubstitutionText(java.lang.String substitutionName)
          This method is called to return a String that has been associated with the given substitution name.
 void put(java.lang.String substitutionName, java.lang.Object substitutionValue)
          This method associated the given substitution name with a string value.
 void setStringMap(java.util.HashMap newStringMap)
          Sets the underlying HashMap of named String values. 99% of the time there is no need to call this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTextSubstitution

public SimpleTextSubstitution()
SimpleTextSubstitution constructor that creates its own empty HashMap.


SimpleTextSubstitution

public SimpleTextSubstitution(java.util.HashMap newStringMap)
SimpleTextSubstitution constructor that takes a primed HashMap of string mappings.

Method Detail

getStringMap

public java.util.HashMap getStringMap()
Returns the underlying HashMap containing named string.

Returns:
java.util.HashMap

getSubstitutionText

public java.lang.String getSubstitutionText(java.lang.String substitutionName)
This method is called to return a String that has been associated with the given substitution name.

Specified by:
getSubstitutionText in interface TextSubstitution

put

public void put(java.lang.String substitutionName,
                java.lang.Object substitutionValue)
This method associated the given substitution name with a string value.


setStringMap

public void setStringMap(java.util.HashMap newStringMap)
Sets the underlying HashMap of named String values. 99% of the time there is no need to call this method.

Parameters:
newStringMap - java.util.HashMap

EchoPoint
1.0