public class GenericExporter extends Object
Example with Querydsl annotations:
GenericExporter exporter = new GenericExporter();
exporter.setTargetFolder(new File("target/generated-sources/java"));
exporter.export(com.example.domain.Entity.class.getPackage());
Example with JPA annotations:
GenericExporter exporter = new GenericExporter();
exporter.setKeywords(Keywords.JPA);
exporter.setEntityAnnotation(Entity.class);
exporter.setEmbeddableAnnotation(Embeddable.class);
exporter.setEmbeddedAnnotation(Embedded.class);
exporter.setSupertypeAnnotation(MappedSuperclass.class);
exporter.setSkipAnnotation(Transient.class);
exporter.setTargetFolder(new File("target/generated-sources/java"));
exporter.export(com.example.domain.Entity.class.getPackage());
| Constructor and Description |
|---|
GenericExporter()
Create a GenericExporter instance using the context classloader and default charset
|
GenericExporter(Charset charset)
Create a GenericExporter instance using the context classloader and the given charset
|
GenericExporter(ClassLoader classLoader)
Create a GenericExporter instance using the given classloader and default charset
|
GenericExporter(ClassLoader classLoader,
Charset charset)
Create a GenericExporter instance using the given classloader and charset for serializing
source files
|
| Modifier and Type | Method and Description |
|---|---|
void |
addStopClass(Class<?> cl)
Add a stop class to be used (default Object.class and Enum.class)
|
void |
export(Class<?>... classes)
Export the given classes
|
void |
export(Package... packages)
Export the given packages
|
void |
export(String... packages)
Export the given packages
|
Set<File> |
getGeneratedFiles() |
void |
setCreateScalaSources(boolean createScalaSources)
Set whether Scala sources are generated
|
void |
setEmbeddableAnnotation(Class<? extends Annotation> embeddableAnnotation)
Set the embeddable annotation
|
void |
setEmbeddedAnnotation(Class<? extends Annotation> embeddedAnnotation)
Set the embedded annotation
|
void |
setEntityAnnotation(Class<? extends Annotation> entityAnnotation)
Set the entity annotation
|
void |
setHandleFields(boolean b)
Set whether fields are handled (default true)
|
void |
setHandleMethods(boolean b)
Set whether fields are handled (default true)
|
void |
setKeywords(Collection<String> keywords)
Set the keywords to be used
|
void |
setNamePrefix(String prefix)
Set the name prefix
|
void |
setNameSuffix(String suffix)
Set the name suffix
|
void |
setPackageSuffix(String suffix)
Set the package suffix
|
void |
setSerializerClass(Class<? extends Serializer> serializerClass)
Set the serializer class to be used
|
void |
setSkipAnnotation(Class<? extends Annotation> skipAnnotation)
Set the skip annotation
|
void |
setSupertypeAnnotation(Class<? extends Annotation> supertypeAnnotation)
Set the supertype annotation
|
void |
setTargetFolder(File targetFolder)
Set the target folder for generated sources
|
void |
setTypeMappingsClass(Class<? extends TypeMappings> typeMappingsClass)
Set the typemappings class to be used
|
public GenericExporter(ClassLoader classLoader, Charset charset)
classLoader - charset - public GenericExporter(ClassLoader classLoader)
classLoader - public GenericExporter(Charset charset)
charset - public GenericExporter()
public void export(Package... packages)
packages - public void export(String... packages)
packages - public void export(Class<?>... classes)
classes - public void setEntityAnnotation(Class<? extends Annotation> entityAnnotation)
entityAnnotation - public void setSupertypeAnnotation(Class<? extends Annotation> supertypeAnnotation)
supertypeAnnotation - public void setEmbeddableAnnotation(Class<? extends Annotation> embeddableAnnotation)
embeddableAnnotation - public void setEmbeddedAnnotation(Class<? extends Annotation> embeddedAnnotation)
embeddedAnnotation - public void setSkipAnnotation(Class<? extends Annotation> skipAnnotation)
skipAnnotation - public void setTargetFolder(File targetFolder)
targetFolder - public void setSerializerClass(Class<? extends Serializer> serializerClass)
serializerClass - public void setTypeMappingsClass(Class<? extends TypeMappings> typeMappingsClass)
typeMappingsClass - public void setCreateScalaSources(boolean createScalaSources)
createScalaSources - public void setKeywords(Collection<String> keywords)
keywords - public void setNamePrefix(String prefix)
prefix - public void setNameSuffix(String suffix)
suffix - public void setPackageSuffix(String suffix)
suffix - public void setHandleFields(boolean b)
b - public void setHandleMethods(boolean b)
b - public void addStopClass(Class<?> cl)
cl - Copyright © 2007–2014 Mysema Ltd. All rights reserved.