Search in sources :

Example 11 with DeclaredTypeName

use of com.yahoo.aptutils.model.DeclaredTypeName 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)

Example 12 with DeclaredTypeName

use of com.yahoo.aptutils.model.DeclaredTypeName in project squidb by yahoo.

the class JSONPropertyGenerator method getPropertyType.

@Override
public DeclaredTypeName getPropertyType() {
    DeclaredTypeName jsonProperty = JSONTypes.JSON_PROPERTY.clone();
    jsonProperty.setTypeArgs(Collections.singletonList(fieldType));
    return jsonProperty;
}
Also used : DeclaredTypeName(com.yahoo.aptutils.model.DeclaredTypeName)

Aggregations

DeclaredTypeName (com.yahoo.aptutils.model.DeclaredTypeName)12 Expression (com.yahoo.aptutils.writer.expressions.Expression)3 ArrayList (java.util.ArrayList)3 TypeName (com.yahoo.aptutils.model.TypeName)2 MethodDeclarationParameters (com.yahoo.aptutils.writer.parameters.MethodDeclarationParameters)2 TypeElement (javax.lang.model.element.TypeElement)2 VariableElement (javax.lang.model.element.VariableElement)2 TypeDeclarationParameters (com.yahoo.aptutils.writer.parameters.TypeDeclarationParameters)1 Implements (com.yahoo.squidb.annotations.Implements)1 ErrorInfo (com.yahoo.squidb.processor.data.ErrorInfo)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 AnnotationMirror (javax.lang.model.element.AnnotationMirror)1 AnnotationValue (javax.lang.model.element.AnnotationValue)1 Element (javax.lang.model.element.Element)1