org.jibx.schema.codegen.extend
Interface NameConverter

All Known Implementing Classes:
DefaultNameConverter

public interface NameConverter

Interface for working with Java names during code generation.

Author:
Dennis M. Sosnoski

Method Summary
 java.lang.String depluralize(java.lang.String name)
          Convert potentially plural name to singular form.
 java.lang.String pluralize(java.lang.String name)
          Convert singular name to plural form.
 java.lang.String[] splitXMLWords(java.lang.String name)
          Split an XML name into words.
 java.lang.String toBaseName(java.lang.String xname)
          Convert an XML name to a Java value base name.
 java.lang.String toConstantName(java.lang.String text)
          Convert text to constant name.
 java.lang.String toFieldName(java.lang.String base)
          Convert base name to normal field name.
 java.lang.String toIfSetAccessMethodName(java.lang.String prop)
          Convert property name to if set access method name (for value in set of alternatives).
 java.lang.String toJavaClassName(java.lang.String xname)
          Convert a base name to a legal Java class name.
 java.lang.String toPropertyName(java.lang.String base)
          Convert base name to property name (used for all method names).
 java.lang.String toReadAccessMethodName(java.lang.String prop)
          Convert property name to read access method name.
 java.lang.String toStaticFieldName(java.lang.String base)
          Convert base name to static field name.
 java.lang.String toTestAccessMethodName(java.lang.String prop)
          Convert property name to test access method name (for boolean value).
 java.lang.String toWriteAccessMethodName(java.lang.String prop)
          Convert property name to write access method name.
 java.lang.String trimXName(java.lang.String xname)
          Trim specified prefixes and/or suffixes from an XML name.
 

Method Detail

pluralize

java.lang.String pluralize(java.lang.String name)
Convert singular name to plural form.

Parameters:
name - base name
Returns:
plural name

depluralize

java.lang.String depluralize(java.lang.String name)
Convert potentially plural name to singular form.

Parameters:
name - base name
Returns:
singularized name

toBaseName

java.lang.String toBaseName(java.lang.String xname)
Convert an XML name to a Java value base name. The base name is in normalized camelcase form with leading lower case (unless the first word of the name is all uppercase).

Parameters:
xname - XML name
Returns:
converted name

toJavaClassName

java.lang.String toJavaClassName(java.lang.String xname)
Convert a base name to a legal Java class name.

Parameters:
xname - XML name
Returns:
converted name

toConstantName

java.lang.String toConstantName(java.lang.String text)
Convert text to constant name. The constant name must not match a Java keyword.

Parameters:
text - raw text to be converted
Returns:
constant name

toFieldName

java.lang.String toFieldName(java.lang.String base)
Convert base name to normal field name. The field name must not match a Java keyword.

Parameters:
base - normalized camelcase base name
Returns:
field name

toStaticFieldName

java.lang.String toStaticFieldName(java.lang.String base)
Convert base name to static field name. The field name must not match a Java keyword.

Parameters:
base - normalized camelcase base name
Returns:
field name

toPropertyName

java.lang.String toPropertyName(java.lang.String base)
Convert base name to property name (used for all method names). The property name is always in initial-upper camelcase form.

Parameters:
base - normalized camelcase base name
Returns:
property name in initial-upper camelcase form

toReadAccessMethodName

java.lang.String toReadAccessMethodName(java.lang.String prop)
Convert property name to read access method name.

Parameters:
prop - property name in initial-upper camelcase form
Returns:
read access method name

toWriteAccessMethodName

java.lang.String toWriteAccessMethodName(java.lang.String prop)
Convert property name to write access method name.

Parameters:
prop - property name in initial-upper camelcase form
Returns:
write access method name

toTestAccessMethodName

java.lang.String toTestAccessMethodName(java.lang.String prop)
Convert property name to test access method name (for boolean value).

Parameters:
prop - property name in initial-upper camelcase form
Returns:
test access method name

toIfSetAccessMethodName

java.lang.String toIfSetAccessMethodName(java.lang.String prop)
Convert property name to if set access method name (for value in set of alternatives).

Parameters:
prop - property name in initial-upper camelcase form
Returns:
if set access method name

trimXName

java.lang.String trimXName(java.lang.String xname)
Trim specified prefixes and/or suffixes from an XML name.

Parameters:
xname - XML name
Returns:
trimmed name, with specified prefixes and/or suffixes removed

splitXMLWords

java.lang.String[] splitXMLWords(java.lang.String name)
Split an XML name into words. This splits first on the basis of separator characters ('.', '-', and '_') in the name, and secondly based on case (an uppercase character immediately followed by one or more lowercase characters is considered a word, and multiple uppercase characters not followed immediately by a lowercase character are also considered a word). Characters which are not valid as parts of identifiers in Java are dropped from the XML name before it is split, and words starting with initial uppercase characters have the upper case dropped for consistency. Note that this method is not threadsafe.

Parameters:
name -
Returns:
array of words


Project Web Site