org.apache.commons.betwixt.strategy
Class BadCharacterReplacingNMapper

java.lang.Object
  extended by org.apache.commons.betwixt.strategy.BadCharacterReplacingNMapper
All Implemented Interfaces:
NameMapper

public class BadCharacterReplacingNMapper
extends java.lang.Object
implements NameMapper

NameMapper implementation that processes a name by replacing or stripping illegal characters before passing result down the chain.

Since:
0.5
Author:
Robert Burrell Donkin

Constructor Summary
BadCharacterReplacingNMapper(NameMapper chainedMapper)
          Constructs a replacing mapper which delegates to given mapper.
 
Method Summary
 java.lang.Character getReplacement()
          Gets the character that should be used to replace bad characters if null then bad characters will be deleted.
 java.lang.String mapTypeToElementName(java.lang.String typeName)
          This implementation processes characters which are not allowed in xml element names and then returns the result from the next link in the chain.
 void setReplacement(java.lang.Character replacement)
          Sets the character that should be used to replace bad characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BadCharacterReplacingNMapper

public BadCharacterReplacingNMapper(NameMapper chainedMapper)
Constructs a replacing mapper which delegates to given mapper.

Parameters:
chainedMapper - next link in processing chain, possibly null
Method Detail

getReplacement

public java.lang.Character getReplacement()
Gets the character that should be used to replace bad characters if null then bad characters will be deleted.

Returns:
the replacement Character possibly null

setReplacement

public void setReplacement(java.lang.Character replacement)
Sets the character that should be used to replace bad characters.

Parameters:
replacement - the Charcter to be used for replacement if not null. Otherwise, indicates that illegal characters should be deleted.

mapTypeToElementName

public java.lang.String mapTypeToElementName(java.lang.String typeName)
This implementation processes characters which are not allowed in xml element names and then returns the result from the next link in the chain. This processing consists of deleting them if no replacement character has been set. Otherwise, the character will be replaced.

Specified by:
mapTypeToElementName in interface NameMapper
Parameters:
typeName - the string to convert
Returns:
the processed input


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.