public class JavaTypeMapper extends Object
| Constructor and Description |
|---|
JavaTypeMapper() |
| Modifier and Type | Method and Description |
|---|---|
String |
box(String t)
Get the boxed type name.
|
Type |
fromJavaClass(Schema.SchemaBuilder schemaBuilder,
Class<?> javaType)
Generate Tesla schema from Java class by reflection.
|
JavaTypeDescriptor |
getTypeDescriptor(Type t)
Obtains Java type descriptor which describes type mapping information for a given Tesla type.
|
boolean |
isMapToJavaArray()
Determines if Tesla arrays are mapped to Java arrays.
|
void |
setMapToJavaArray(boolean mapToJavaArray)
Configures the default Tesla array mapping when an array type specified without detailed container type
information.
|
String |
symbol(Type t)
Create an unique symbol for a Tesla type that can be used in the generated source code.
|
public boolean isMapToJavaArray()
true, Tesla arrays without detailed
container type information will be mapped to java arrays. Otherwise, they will be mapped to ArrayList.true if map to Java array;
false otherwise.public void setMapToJavaArray(boolean mapToJavaArray)
Set to true will map arrays to Java arrays. Otherwise, they will be mapped to ArrayList.
mapToJavaArray - if map to Java array;public JavaTypeDescriptor getTypeDescriptor(Type t) throws TeslaSchemaException
t - The Tesla type.JavaTypeDescriptor object that describes the mapped Java types.TeslaSchemaException - On a mapping error.public String symbol(Type t)
t - The Tesla type.public String box(String t)
t - Java type name.public Type fromJavaClass(Schema.SchemaBuilder schemaBuilder, Class<?> javaType) throws TeslaSchemaException
Tesla can generate schema from existing Java classes that follow the JavaBeans Spec. Only properties with following attributes will be included:
SkipField annotation.
Tesla will map Java type to it's closest Tesla type by default.
Developers can override this by either providing their own
TypeMapper, or with Tesla annoations.
Tesla will map all Java object types to nullable types only for class
properties. If you want an property to be not nullable, use annotation
NotNullable.
schemaBuilder - All non-primitive Tesla types must be defined inside a schema.
This is the schema object into which the Tesla type will be
generated.javaType - The java class object.TeslaSchemaExceptionCopyright © 2015. All Rights Reserved.