Java Code Examples for org.raml.v2.api.model.v10.datamodel.TypeDeclaration#defaultValue()

The following examples show how to use org.raml.v2.api.model.v10.datamodel.TypeDeclaration#defaultValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JacksonBasicExtension.java    From raml-java-tools with Apache License 2.0 5 votes vote down vote up
@Override
public FieldSpec.Builder fieldBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, FieldSpec.Builder fieldSpec, EventType eventType) {
    AnnotationSpec.Builder annotation = AnnotationSpec.builder(JsonProperty.class)
            .addMember("value", "$S", declaration.name());
    if (declaration.defaultValue() != null) {
        annotation.addMember("defaultValue", "$S", declaration.defaultValue());

    }
    return fieldSpec.addAnnotation(
            annotation.build());
}
 
Example 2
Source File: JacksonBasicExtension.java    From raml-java-tools with Apache License 2.0 5 votes vote down vote up
@Override
public MethodSpec.Builder getterBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, MethodSpec.Builder methodSpec, EventType eventType) {

    AnnotationSpec.Builder annotation = AnnotationSpec.builder(JsonProperty.class)
            .addMember("value", "$S", declaration.name());
    if (declaration.defaultValue() != null) {
        annotation.addMember("defaultValue", "$S", declaration.defaultValue());
    }

    return methodSpec.addAnnotation(annotation.build());
}
 
Example 3
Source File: JacksonBasicExtension.java    From raml-java-tools with Apache License 2.0 5 votes vote down vote up
@Override
public FieldSpec.Builder fieldBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, FieldSpec.Builder fieldSpec, EventType eventType) {
    AnnotationSpec.Builder annotation = AnnotationSpec.builder(JsonProperty.class)
            .addMember("value", "$S", declaration.name());
    if (declaration.defaultValue() != null) {
        annotation.addMember("defaultValue", "$S", declaration.defaultValue());

    }
    return fieldSpec.addAnnotation(
            annotation.build());
}
 
Example 4
Source File: JacksonBasicExtension.java    From raml-java-tools with Apache License 2.0 5 votes vote down vote up
@Override
public MethodSpec.Builder getterBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, MethodSpec.Builder methodSpec, EventType eventType) {

    AnnotationSpec.Builder annotation = AnnotationSpec.builder(JsonProperty.class)
            .addMember("value", "$S", declaration.name());
    if (declaration.defaultValue() != null) {
        annotation.addMember("defaultValue", "$S", declaration.defaultValue());
    }

    return methodSpec.addAnnotation(annotation.build());
}
 
Example 5
Source File: JacksonBasicExtension.java    From raml-java-tools with Apache License 2.0 5 votes vote down vote up
@Override
public MethodSpec.Builder setterBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, MethodSpec.Builder methodSpec, EventType eventType) {
    AnnotationSpec.Builder annotation = AnnotationSpec.builder(JsonProperty.class)
            .addMember("value", "$S", declaration.name());
    if (declaration.defaultValue() != null) {
        annotation.addMember("defaultValue", "$S", declaration.defaultValue());
    }

    return methodSpec.addAnnotation(annotation.build());
}