public class BindingHelper extends Object
Constructor and Description |
---|
BindingHelper() |
Modifier and Type | Method and Description |
---|---|
static <T> Class<T> |
erasure(Type t) |
static Type |
getBaseType(Type type,
Class baseType)
Gets the parameterization of the given base type.
|
static String |
mangleNameToClassName(String localName)
Computes a Java class name from a local name.
|
static String |
mangleNameToPropertyName(String localName)
Computes a Java class name from a local name.
|
static String |
mangleNameToVariableName(String localName)
Computes a Java identifier from a local name.
|
@NotNull public static String mangleNameToVariableName(@NotNull String localName)
This method faithfully implements the name mangling rule as specified in the JAXB spec.
In JAXB, a collision with a Java reserved word (such as "return") never happens. Accordingly, this method may return an identifier that collides with reserved words.
Use JJavaName.isJavaIdentifier(String) to check for such collision.
@NotNull public static String mangleNameToClassName(@NotNull String localName)
This method faithfully implements the name mangling rule as specified in the JAXB spec.
@NotNull public static String mangleNameToPropertyName(@NotNull String localName)
This method faithfully implements the name mangling rule as specified in the JAXB spec.
This method works like mangleNameToClassName(String)
except that it looks
for "getClass" and returns something else.
@Nullable public static Type getBaseType(@NotNull Type type, @NotNull Class baseType)
For example, given the following
This method works like this:interface Foo extends List > {} interface Bar extends Foo
{}
getBaseClass( Bar, List ) = List getBaseClass( Bar, Foo ) = Foo
getBaseClass( Foo extends Number>, Collection ) = Collection > getBaseClass( ArrayList extends BigInteger>, List ) = List extends BigInteger>
type
- The type that derives from baseType
baseType
- The class whose parameterization we are interested in.baseType
in type
.
or null if the type is not assignable to the base type.Copyright © 2015 Oracle Corporation. All rights reserved.