org.apache.tapestry.util.text
Class AsciiCharacterTranslator

java.lang.Object
  extended by org.apache.tapestry.util.text.AsciiCharacterTranslator
All Implemented Interfaces:
ICharacterTranslator

public class AsciiCharacterTranslator
extends Object
implements ICharacterTranslator

An object that translates selected ASCII characters into equivalent strings.

Since:
4.0
Author:
mb

Constructor Summary
AsciiCharacterTranslator(String[][] characterMap)
          Creates and initializes a new translator that translates the provided ASCII characters into strings.
 
Method Summary
 String translate(char ch)
          Translates the provided character into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsciiCharacterTranslator

public AsciiCharacterTranslator(String[][] characterMap)
Creates and initializes a new translator that translates the provided ASCII characters into strings. All other characters will be translated to null.

Parameters:
characterMap - an array of pairs of strings. Each pair consists of a key that must be a single ASCII character, and a value that is its equivalent string.
Method Detail

translate

public String translate(char ch)
Description copied from interface: ICharacterTranslator
Translates the provided character into a string.

Specified by:
translate in interface ICharacterTranslator
Parameters:
ch - the character to be translated
Returns:
null if the character is not to be translated, an empty string if the character is to be ignored, or another string to represent the character translation
See Also:
.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.