use of org.mybatis.generator.codegen.AbstractJavaGenerator in project generator by mybatis.
the class IntrospectedTableMyBatis3Impl method calculateJavaModelGenerators.
/**
* Calculate java model generators.
*
* @param warnings
* the warnings
* @param progressCallback
* the progress callback
*/
protected void calculateJavaModelGenerators(List<String> warnings, ProgressCallback progressCallback) {
if (getRules().generateExampleClass()) {
AbstractJavaGenerator javaGenerator = new ExampleGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
if (getRules().generatePrimaryKeyClass()) {
AbstractJavaGenerator javaGenerator = new PrimaryKeyGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
if (getRules().generateBaseRecordClass()) {
AbstractJavaGenerator javaGenerator = new BaseRecordGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
if (getRules().generateRecordWithBLOBsClass()) {
AbstractJavaGenerator javaGenerator = new RecordWithBLOBsGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
}
use of org.mybatis.generator.codegen.AbstractJavaGenerator in project generator by mybatis.
the class IntrospectedTableMyBatis3SimpleImpl method calculateJavaModelGenerators.
@Override
protected void calculateJavaModelGenerators(List<String> warnings, ProgressCallback progressCallback) {
AbstractJavaGenerator javaGenerator = new SimpleModelGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
use of org.mybatis.generator.codegen.AbstractJavaGenerator in project generator by mybatis.
the class IntrospectedTableIbatis2Java2Impl method getGeneratedJavaFiles.
@Override
public List<GeneratedJavaFile> getGeneratedJavaFiles() {
List<GeneratedJavaFile> answer = new ArrayList<GeneratedJavaFile>();
for (AbstractJavaGenerator javaGenerator : javaModelGenerators) {
List<CompilationUnit> compilationUnits = javaGenerator.getCompilationUnits();
for (CompilationUnit compilationUnit : compilationUnits) {
GeneratedJavaFile gjf = new GeneratedJavaFile(compilationUnit, context.getJavaModelGeneratorConfiguration().getTargetProject(), context.getProperty(PropertyRegistry.CONTEXT_JAVA_FILE_ENCODING), context.getJavaFormatter());
answer.add(gjf);
}
}
for (AbstractJavaGenerator javaGenerator : daoGenerators) {
List<CompilationUnit> compilationUnits = javaGenerator.getCompilationUnits();
for (CompilationUnit compilationUnit : compilationUnits) {
GeneratedJavaFile gjf = new GeneratedJavaFile(compilationUnit, context.getJavaClientGeneratorConfiguration().getTargetProject(), context.getProperty(PropertyRegistry.CONTEXT_JAVA_FILE_ENCODING), context.getJavaFormatter());
answer.add(gjf);
}
}
return answer;
}
use of org.mybatis.generator.codegen.AbstractJavaGenerator in project generator by mybatis.
the class IntrospectedTableIbatis2Java2Impl method calculateDAOGenerators.
protected void calculateDAOGenerators(List<String> warnings, ProgressCallback progressCallback) {
if (context.getJavaClientGeneratorConfiguration() == null) {
return;
}
String type = context.getJavaClientGeneratorConfiguration().getConfigurationType();
AbstractJavaGenerator javaGenerator;
if ("IBATIS".equalsIgnoreCase(type)) {
//$NON-NLS-1$
javaGenerator = new DAOGenerator(new IbatisDAOTemplate(), isJava5Targeted());
} else if ("SPRING".equalsIgnoreCase(type)) {
//$NON-NLS-1$
javaGenerator = new DAOGenerator(new SpringDAOTemplate(), isJava5Targeted());
} else if ("GENERIC-CI".equalsIgnoreCase(type)) {
//$NON-NLS-1$
javaGenerator = new DAOGenerator(new GenericCIDAOTemplate(), isJava5Targeted());
} else if ("GENERIC-SI".equalsIgnoreCase(type)) {
//$NON-NLS-1$
javaGenerator = new DAOGenerator(new GenericSIDAOTemplate(), isJava5Targeted());
} else {
javaGenerator = (AbstractJavaGenerator) ObjectFactory.createInternalObject(type);
}
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
daoGenerators.add(javaGenerator);
}
use of org.mybatis.generator.codegen.AbstractJavaGenerator in project generator by mybatis.
the class IntrospectedTableIbatis2Java2Impl method calculateJavaModelGenerators.
protected void calculateJavaModelGenerators(List<String> warnings, ProgressCallback progressCallback) {
if (getRules().generateExampleClass()) {
AbstractJavaGenerator javaGenerator = new ExampleGenerator(isJava5Targeted());
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
if (getRules().generatePrimaryKeyClass()) {
AbstractJavaGenerator javaGenerator = new PrimaryKeyGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
if (getRules().generateBaseRecordClass()) {
AbstractJavaGenerator javaGenerator = new BaseRecordGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
if (getRules().generateRecordWithBLOBsClass()) {
AbstractJavaGenerator javaGenerator = new RecordWithBLOBsGenerator();
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
javaModelGenerators.add(javaGenerator);
}
}
Aggregations