use of com.yahoo.aptutils.writer.parameters.TypeDeclarationParameters in project squidb by yahoo.
the class ModelFileWriter method beginClassDeclaration.
private void beginClassDeclaration() throws IOException {
if (modelSpec.getModelSpecElement().getAnnotation(Deprecated.class) != null) {
writer.writeAnnotation(CoreTypes.DEPRECATED);
}
TypeDeclarationParameters params = new TypeDeclarationParameters().setName(modelSpec.getGeneratedClassName()).setSuperclass(modelSpec.getModelSuperclass()).setInterfaces(accumulateInterfacesFromPlugins()).setKind(Type.CLASS).setModifiers(Modifier.PUBLIC);
writer.beginTypeDefinition(params);
}
use of com.yahoo.aptutils.writer.parameters.TypeDeclarationParameters in project squidb by yahoo.
the class ErrorLoggingPlugin method emitAdditionalJava.
@Override
public void emitAdditionalJava(JavaFileWriter writer) throws IOException {
List<ErrorInfo> errors = modelSpec.getLoggedErrors();
if (errors.size() > 0) {
writer.writeExpression(new ModelGenErrorsExpression(errors)).writeNewline();
TypeDeclarationParameters dummyErrorClass = new TypeDeclarationParameters().setModifiers(Modifier.STATIC, Modifier.FINAL).setName(new DeclaredTypeName(modelSpec.getGeneratedClassName().toString(), "LoggedErrors")).setKind(JavaFileWriter.Type.CLASS);
writer.beginTypeDefinition(dummyErrorClass);
writer.writeComment("Dummy class for holding logged error annotations");
writer.finishTypeDefinition();
}
}
Aggregations