Annotation Type ApiProperty


  • @Target({METHOD,FIELD})
    @Retention(RUNTIME)
    public @interface ApiProperty
    Registers a property getter with the API framework. When a model is serialized the property is included in the properties section of the serialized JSON.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean flattenMap
      Boolean used when a method or field is a Map of name/value pairs.
      java.lang.String name
      The name of the property to be serialized.
      ApiProperty.SCOPE scope
      The scope in which the property should be serialized.
    • Element Detail

      • name

        java.lang.String name
        The name of the property to be serialized. If the name isn't explicity specified, then the name of the method or field is used in lowercase, with prefixes "get" or "is" removed.
        Returns:
        The name of the property
        Default:
        ""
      • scope

        ApiProperty.SCOPE scope
        The scope in which the property should be serialized. If SCOPE.RESOURCE the property will be serialized for a resource that is the main entity. If SCOPE.INLINE the property will be serialized for a resource that is a sub-entity of another resource. By default the property will be serialized in both cases.
        Returns:
        The scope in which this property should be serialized.
        Default:
        com.adobe.granite.haf.annotations.ApiProperty.SCOPE.BOTH
      • flattenMap

        boolean flattenMap
        Boolean used when a method or field is a Map of name/value pairs. If true the properties contained in the Map will be serialized each on their own at the top level of the properties section of the entity. If false, the Map will be serialzied as a single property in the property section.
        Returns:
        Whether or not to flatten a map in the properties section
        Default:
        false