Class DefaultAnnotationStrategy

java.lang.Object
com.sap.cloud.sdk.datamodel.odatav4.generator.annotation.DefaultAnnotationStrategy
All Implemented Interfaces:
AnnotationStrategy

public class DefaultAnnotationStrategy extends Object implements AnnotationStrategy
Default implementation of AnnotationStrategy that applies the necessary annotations for the full set of generated VDM classes (POJOs, fluent helpers, service classes, etc.), which uses the SAP Cloud SDK to access OData services.
  • Constructor Details

    • DefaultAnnotationStrategy

      public DefaultAnnotationStrategy()
  • Method Details

    • getAnnotationsForEntity

      @Nonnull public Set<AnnotationDefinition> getAnnotationsForEntity(@Nonnull EntityAnnotationModel context)
      Default implementation for the SAP Cloud SDK which adds the following annotations:
      • Lombok Builder, NoArgsConstructor, and AllArgsConstructor. But only if there are less than 254 properties in the entity (Java constructor limitation).
      • Lombok Data
      • Lombok ToString with parameters doNotUseGetters=true and callSuper=true
      • Lombok EqualsAndHashCode with parameters doNotUseGetters=true and callSuper=true
      • Gson JsonAdapter with default parameter set to ODataVdmEntityAdapterFactory.class, for deserializing OData responses.
      Specified by:
      getAnnotationsForEntity in interface AnnotationStrategy
      Parameters:
      context - Object representing an OData entity.
      Returns:
      Default set of annotations that are needed by the SAP Cloud SDK implementation of the VDM.
    • getAnnotationsForEntityProperty

      @Nonnull public Set<AnnotationDefinition> getAnnotationsForEntityProperty(@Nonnull EntityPropertyAnnotationModel context)
      Default implementation for the SAP Cloud SDK which adds the following annotations:
      • Gson SerializedName with the value set to the OData EDM name of the entity property.
      • Jackson JsonProperty with the value set to the OData EDM name of the entity property.
      • Nullable
      • Gson JsonAdapter with default parameter set to an appropriate TypeAdapter class. The adapter used is based on the OData EDM type of the entity property.
      Specified by:
      getAnnotationsForEntityProperty in interface AnnotationStrategy
      Parameters:
      context - Object representing an OData entity property.
      Returns:
      Default set of annotations that are needed by the SAP Cloud SDK implementation of the VDM.
    • getAnnotationsForAssociatedEntity

      @Nonnull public Set<AnnotationDefinition> getAnnotationsForAssociatedEntity(@Nonnull NavigationPropertyAnnotationModel context)
      Default implementation for the SAP Cloud SDK which adds the following annotations:
      • Gson SerializedName with the value set to the OData EDM name of the navigation property.
      • Jackson JsonProperty with the value set to the OData EDM name of the navigation property.
      • Nullable, but only if the multiplicity of the navigation property is 1..1 or 0..1
      Specified by:
      getAnnotationsForAssociatedEntity in interface AnnotationStrategy
      Parameters:
      context - Object representing an OData navigation property.
      Returns:
      Default set of annotations that are needed by the SAP Cloud SDK implementation of the VDM.
    • getAnnotationsForComplexType

      @Nonnull public Set<AnnotationDefinition> getAnnotationsForComplexType(@Nonnull EntityAnnotationModel context)
      Default implementation for the SAP Cloud SDK which adds the following annotations:
      • Lombok Builder, NoArgsConstructor, and AllArgsConstructor. But only if there are less than 254 properties in the entity (Java constructor limitation).
      • Lombok Data
      • Lombok ToString with parameters doNotUseGetters=true and callSuper=true
      • Lombok EqualsAndHashCode with parameters doNotUseGetters=true and callSuper=true
      • Gson JsonAdapter with default parameter set to ODataVdmEntityAdapterFactory.class, for deserializing OData responses.
      Specified by:
      getAnnotationsForComplexType in interface AnnotationStrategy
      Parameters:
      context - Object representing an OData complex type.
      Returns:
      Default set of annotations that are needed by the SAP Cloud SDK implementation of the VDM.
    • getAnnotationsForComplexTypeProperty

      @Nonnull public Set<AnnotationDefinition> getAnnotationsForComplexTypeProperty(@Nonnull EntityPropertyAnnotationModel context)
      Default implementation for the SAP Cloud SDK which adds the following annotations:
      • Gson SerializedName with the value set to the OData EDM name of the complex type property.
      • Jackson JsonProperty with the value set to the OData EDM name of the complex type property.
      • Nullable
      • Gson JsonAdapter with default parameter set to an appropriate TypeAdapter class. The adapter used is based on the OData EDM type of the complex type property.
      Specified by:
      getAnnotationsForComplexTypeProperty in interface AnnotationStrategy
      Parameters:
      context - Object representing an OData complex type property.
      Returns:
      Default set of annotations that are needed by the SAP Cloud SDK implementation of the VDM.