Top Description Inners Fields Methods
org.glassfish.jaxb.core.api.impl

public Interface NameConverter

Known Direct Implementers
org.glassfish.jaxb.core.api.impl.NameConverter.Standard
Imports
javax.lang.model.SourceVersion, java.util.ArrayList, .List, .StringTokenizer

Converts aribitrary strings into Java identifiers.
Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final NameConverter
jaxrpcCompatible

JAX-PRC compatible name converter implementation.

public static final NameConverter
smart

Smarter converter used for RELAX NG support.

public static final NameConverter
standard

The name converter implemented by Code Model.

Method Summary

Modifier and TypeMethod and Description
public String
toClassName(String token)

converts a string into an identifier suitable for classes.

public String
toConstantName(String token)

converts a string into an identifier suitable for constants.

public String
toInterfaceName(String token)

converts a string into an identifier suitable for interfaces.

public String
toPackageName(String namespaceUri)

Converts a namespace URI into a package name.

public String
toPropertyName(String token)

converts a string into an identifier suitable for properties.

public String
toVariableName(String token)

Converts a string into an identifier suitable for variables.

Field Detail

jaxrpcCompatibleback to summary
public static final NameConverter jaxrpcCompatible

JAX-PRC compatible name converter implementation. The only difference is that we treat '_' as a valid character and not as a word separator.

smartback to summary
public static final NameConverter smart

Smarter converter used for RELAX NG support.

standardback to summary
public static final NameConverter standard

The name converter implemented by Code Model. This is the standard name conversion for JAXB.

Method Detail

toClassNameback to summary
public String toClassName(String token)

converts a string into an identifier suitable for classes. In general, this operation should generate "NamesLikeThis".

toConstantNameback to summary
public String toConstantName(String token)

converts a string into an identifier suitable for constants. In the standard Java naming convention, this operation should generate "NAMES_LIKE_THIS".

toInterfaceNameback to summary
public String toInterfaceName(String token)

converts a string into an identifier suitable for interfaces. In general, this operation should generate "NamesLikeThis". But for example, it can prepend every interface with 'I'.

toPackageNameback to summary
public String toPackageName(String namespaceUri)

Converts a namespace URI into a package name. This method should expect strings like "http://foo.bar.zot/org", "urn:abc:def:ghi" "", or even "###" (basically anything) and expected to return a package name, liks "org.acme.foo".

toPropertyNameback to summary
public String toPropertyName(String token)

converts a string into an identifier suitable for properties. In general, this operation should generate "NamesLikeThis", which will be used with known prefixes like "get" or "set".

toVariableNameback to summary
public String toVariableName(String token)

Converts a string into an identifier suitable for variables. In general it should generate "namesLikeThis".

org.glassfish.jaxb.core.api.impl back to summary

public Class NameConverter.Standard

extends NameUtil
implements NameConverter
Class Inheritance
All Implemented Interfaces
org.glassfish.jaxb.core.api.impl.NameConverter

Field Summary

Inherited from org.glassfish.jaxb.core.api.impl.NameUtil:
DIGITLOWER_LETTEROTHEROTHER_LETTERUPPER_LETTER

Constructor Summary

AccessConstructor and Description
public
Standard()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
private static String
combine(List<String> r, char sep)

private static String
private static <T> ArrayList<T>
reverse(List<T> a)

public String
toClassName(String s)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toClassName.

converts a string into an identifier suitable for classes.

public String
toConstantName(String token)

Overrides org.glassfish.jaxb.core.api.impl.NameUtil.toConstantName.

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toConstantName.

converts a string into an identifier suitable for constants.

public String
toInterfaceName(String token)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toInterfaceName.

converts a string into an identifier suitable for interfaces.

private static ArrayList<String>
public String

Returns:

null if it fails to derive a package name.
toPackageName
(String nsUri)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toPackageName.

Computes a Java package name from a namespace URI, as specified in the spec.

public String
toPropertyName(String s)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toPropertyName.

converts a string into an identifier suitable for properties.

public String
toVariableName(String s)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toVariableName.

Converts a string into an identifier suitable for variables.

Inherited from org.glassfish.jaxb.core.api.impl.NameUtil:
capitalizeclassifyescapeisDigitisLetterisLowerisPunctisUppertoConstantNametoMixedCaseNametoMixedCaseVariableNametoWordList

Constructor Detail

Standardback to summary
public Standard()

Default constructor.

Method Detail

combineback to summary
private static String combine(List<String> r, char sep)
removeIllegalIdentifierCharsback to summary
private static String removeIllegalIdentifierChars(String token)
reverseback to summary
private static <T> ArrayList<T> reverse(List<T> a)
toClassNameback to summary
public String toClassName(String s)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toClassName.

Doc from org.glassfish.jaxb.core.api.impl.NameConverter.toClassName.

converts a string into an identifier suitable for classes. In general, this operation should generate "NamesLikeThis".

Annotations
@Override
toConstantNameback to summary
public String toConstantName(String token)

Overrides org.glassfish.jaxb.core.api.impl.NameUtil.toConstantName.

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toConstantName.

Doc from org.glassfish.jaxb.core.api.impl.NameConverter.toConstantName.

converts a string into an identifier suitable for constants. In the standard Java naming convention, this operation should generate "NAMES_LIKE_THIS".

Annotations
@Override
toInterfaceNameback to summary
public String toInterfaceName(String token)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toInterfaceName.

Doc from org.glassfish.jaxb.core.api.impl.NameConverter.toInterfaceName.

converts a string into an identifier suitable for interfaces. In general, this operation should generate "NamesLikeThis". But for example, it can prepend every interface with 'I'.

Annotations
@Override
tokenizeback to summary
private static ArrayList<String> tokenize(String str, String sep)
toPackageNameback to summary
public String toPackageName(String nsUri)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toPackageName.

Computes a Java package name from a namespace URI, as specified in the spec.

Returns:String

null if it fails to derive a package name.

Annotations
@Override
toPropertyNameback to summary
public String toPropertyName(String s)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toPropertyName.

Doc from org.glassfish.jaxb.core.api.impl.NameConverter.toPropertyName.

converts a string into an identifier suitable for properties. In general, this operation should generate "NamesLikeThis", which will be used with known prefixes like "get" or "set".

Annotations
@Override
toVariableNameback to summary
public String toVariableName(String s)

Implements org.glassfish.jaxb.core.api.impl.NameConverter.toVariableName.

Doc from org.glassfish.jaxb.core.api.impl.NameConverter.toVariableName.

Converts a string into an identifier suitable for variables. In general it should generate "namesLikeThis".

Annotations
@Override