public class GenericExporter
extends java.lang.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(java.nio.charset.Charset charset)
Create a GenericExporter instance using the context classloader and the given charset
|
GenericExporter(java.lang.ClassLoader classLoader)
Create a GenericExporter instance using the given classloader and default charset
|
GenericExporter(java.lang.ClassLoader classLoader,
java.nio.charset.Charset charset)
Create a GenericExporter instance using the given classloader and charset for serializing
source files
|
Modifier and Type | Method and Description |
---|---|
void |
addStopClass(java.lang.Class<?> cl)
Add a stop class to be used (default Object.class and Enum.class)
|
void |
export(java.lang.Class<?>... classes)
Export the given classes
|
void |
export(java.lang.Package... packages)
Export the given packages
|
void |
export(java.lang.String... packages)
Export the given packages
|
java.util.Set<java.io.File> |
getGeneratedFiles() |
void |
setCreateScalaSources(boolean createScalaSources)
Set whether Scala sources are generated
|
void |
setEmbeddableAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> embeddableAnnotation)
Set the embeddable annotation
|
void |
setEmbeddedAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> embeddedAnnotation)
Set the embedded annotation
|
void |
setEntityAnnotation(java.lang.Class<? extends java.lang.annotation.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(java.util.Collection<java.lang.String> keywords)
Set the keywords to be used
|
void |
setNamePrefix(java.lang.String prefix)
Set the name prefix
|
void |
setNameSuffix(java.lang.String suffix)
Set the name suffix
|
void |
setPackageSuffix(java.lang.String suffix)
Set the package suffix
|
void |
setSerializerClass(java.lang.Class<? extends Serializer> serializerClass)
Set the serializer class to be used
|
void |
setSkipAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> skipAnnotation)
Set the skip annotation
|
void |
setSupertypeAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> supertypeAnnotation)
Set the supertype annotation
|
void |
setTargetFolder(java.io.File targetFolder)
Set the target folder for generated sources
|
void |
setTypeMappingsClass(java.lang.Class<? extends TypeMappings> typeMappingsClass)
Set the typemappings class to be used
|
public GenericExporter(java.lang.ClassLoader classLoader, java.nio.charset.Charset charset)
classLoader
- charset
- public GenericExporter(java.lang.ClassLoader classLoader)
classLoader
- public GenericExporter(java.nio.charset.Charset charset)
charset
- public GenericExporter()
public void export(java.lang.Package... packages)
packages
- public void export(java.lang.String... packages)
packages
- public void export(java.lang.Class<?>... classes)
classes
- public java.util.Set<java.io.File> getGeneratedFiles()
public void setEntityAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> entityAnnotation)
entityAnnotation
- public void setSupertypeAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> supertypeAnnotation)
supertypeAnnotation
- public void setEmbeddableAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> embeddableAnnotation)
embeddableAnnotation
- public void setEmbeddedAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> embeddedAnnotation)
embeddedAnnotation
- public void setSkipAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> skipAnnotation)
skipAnnotation
- public void setTargetFolder(java.io.File targetFolder)
targetFolder
- public void setSerializerClass(java.lang.Class<? extends Serializer> serializerClass)
serializerClass
- public void setTypeMappingsClass(java.lang.Class<? extends TypeMappings> typeMappingsClass)
typeMappingsClass
- public void setCreateScalaSources(boolean createScalaSources)
createScalaSources
- public void setKeywords(java.util.Collection<java.lang.String> keywords)
keywords
- public void setNamePrefix(java.lang.String prefix)
prefix
- public void setNameSuffix(java.lang.String suffix)
suffix
- public void setPackageSuffix(java.lang.String suffix)
suffix
- public void setHandleFields(boolean b)
b
- public void setHandleMethods(boolean b)
b
- public void addStopClass(java.lang.Class<?> cl)
cl
- Copyright © 2007-2013 Mysema Ltd. All Rights Reserved.