Search in sources :

Example 1 with TypeDeclarationParameters

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);
}
Also used : TypeDeclarationParameters(com.yahoo.aptutils.writer.parameters.TypeDeclarationParameters)

Example 2 with TypeDeclarationParameters

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();
    }
}
Also used : DeclaredTypeName(com.yahoo.aptutils.model.DeclaredTypeName) TypeDeclarationParameters(com.yahoo.aptutils.writer.parameters.TypeDeclarationParameters) ErrorInfo(com.yahoo.squidb.processor.data.ErrorInfo)

Aggregations

TypeDeclarationParameters (com.yahoo.aptutils.writer.parameters.TypeDeclarationParameters)2 DeclaredTypeName (com.yahoo.aptutils.model.DeclaredTypeName)1 ErrorInfo (com.yahoo.squidb.processor.data.ErrorInfo)1