| java.lang.Object org.apache.commons.betwixt.strategy.HyphenatedNameMapper
HyphenatedNameMapper | public class HyphenatedNameMapper implements NameMapper(Code) | | A name mapper which converts types to a hypenated String. So
a bean type of FooBar will be converted to the element name "foo-bar".
The name mapper can be configured to convert to upper case and to
use a different separator via the separator and
upperCase properties, so that FooBar can be converted
to FOO_BAR if needed, by calling the constructor
new HyphenatedNameMapper(true, "_") .
author: Jason van Zyl author: James Strachan version: $Revision: 471234 $ |
Constructor Summary | |
public | HyphenatedNameMapper() Construct a hyphenated name mapper that converts the name to lower case
and uses the default separator. | public | HyphenatedNameMapper(boolean upperCase) Construct a hyphenated name mapper with default separator. | public | HyphenatedNameMapper(boolean upperCase, String separator) Construct a hyphenated name mapper.
Parameters: upperCase - should the type name be converted (entirely) to upper case Parameters: separator - use this string to separate the words in the name returned. |
Method Summary | |
protected char | convertChar(char ch) | public String | getSeparator() This separator will be inserted between the words in the bean name. | public boolean | isUpperCase() Should the bean name be converted to upper case?
Otherwise, it will be converted to lower case. | public String | mapTypeToElementName(String typeName) The words within the bean name are deduced assuming the
first-letter-capital (for example camel's hump) naming convention. | public void | setSeparator(String separator) | public void | setUpperCase(boolean upperCase) Sets whether upper or lower case conversions should be performed,
which defaults to false for lower case. | public String | toString() Outputs brief description. |
HyphenatedNameMapper | public HyphenatedNameMapper()(Code) | | Construct a hyphenated name mapper that converts the name to lower case
and uses the default separator.
|
HyphenatedNameMapper | public HyphenatedNameMapper(boolean upperCase)(Code) | | Construct a hyphenated name mapper with default separator.
Parameters: upperCase - should the type name be converted (entirely) to upper case |
HyphenatedNameMapper | public HyphenatedNameMapper(boolean upperCase, String separator)(Code) | | Construct a hyphenated name mapper.
Parameters: upperCase - should the type name be converted (entirely) to upper case Parameters: separator - use this string to separate the words in the name returned. The words in the bean name are deduced by relying on the standard camel's humpproperty naming convention. |
convertChar | protected char convertChar(char ch)(Code) | | Performs type conversion on the given character based on whether
upper or lower case conversions are being used
Parameters: ch - the character to be converted converted to upper case if HyphenatedNameMapper.isUpperCase otherwise to lower case |
getSeparator | public String getSeparator()(Code) | | This separator will be inserted between the words in the bean name.
the separator used to seperate words, which defaults to '-' |
isUpperCase | public boolean isUpperCase()(Code) | | Should the bean name be converted to upper case?
Otherwise, it will be converted to lower case.
whether upper or lower case conversions should be performed, which defaults to false for lower case |
mapTypeToElementName | public String mapTypeToElementName(String typeName)(Code) | | The words within the bean name are deduced assuming the
first-letter-capital (for example camel's hump) naming convention. For
example, the words in FooBar are foo
and bar .
Next convert all letter in the bean name to either upper case or lower case
based on the
HyphenatedNameMapper.isUpperCase property value.
Then the
HyphenatedNameMapper.getSeparator property value is inserted so that it separates
each word.
Parameters: typeName - The name string to convert. If a JavaBeanclass name, should included only the last part of the namerather than the fully qualified name (e.g. FooBar rather thanorg.example.FooBar). the bean name converted to either upper or lower case with words separated by the separator. |
setSeparator | public void setSeparator(String separator)(Code) | | Sets the separator used to seperate words, which defaults to '-'
Parameters: separator - the string inserted to separate words |
setUpperCase | public void setUpperCase(boolean upperCase)(Code) | | Sets whether upper or lower case conversions should be performed,
which defaults to false for lower case.
Parameters: upperCase - whether the name is to be converted to upper case |
toString | public String toString()(Code) | | Outputs brief description.
since: 0.8 |
|
|