1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.betwixt.strategy;
18
19 /***
20 * <p>A default implementation of the name mapper.
21 * This mapper simply returns the unmodified type name.</p>
22 *
23 * <p>For example, <code>PropertyName</code> would be converted to <code>PropertyName</code>.
24 *
25 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
26 * @version $Revision: 438373 $
27 */
28 public class DefaultNameMapper implements NameMapper {
29
30 /*** Used to convert bad character in the name */
31 private static final BadCharacterReplacingNMapper badCharacterReplacementNMapper
32 = new BadCharacterReplacingNMapper( new PlainMapper() );
33
34 /*** Base implementation chained by bad character replacement mapper */
35 private static final class PlainMapper implements NameMapper {
36 /***
37 * This implementation returns the parameter passed in without modification.
38 *
39 * @param typeName the string to convert
40 * @return the typeName parameter without modification
41 */
42 public String mapTypeToElementName( String typeName ) {
43 return typeName ;
44 }
45 }
46
47 /***
48 * This implementation returns the parameter passed after
49 * deleting any characters which the XML specification does not allow
50 * in element names.
51 *
52 * @param typeName the string to convert
53 * @return the typeName parameter without modification
54 */
55 public String mapTypeToElementName( String typeName ) {
56 return badCharacterReplacementNMapper.mapTypeToElementName( typeName );
57 }
58 }