Annotation Type ApiModel


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface ApiModel
    Registers a model with the Api Framework. This is the starting point for further processing. This binds either a sling:resourceType or some programmatically mapped Pojo to a resource in Sling.
    See Also:
    ModelLookup
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String category
      The category this API belongs to is the first token in the URL after the api root.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String defaultConverterMediaType
      The default media type to use to find a HypermediaConverter to serialize the model.
      boolean isDefault
      Mark this as the default model for the category.
      java.lang.Class<?> modelClass
      Use this to signal to the framework to managed this object via a different interface.
      java.lang.Class<? extends ModelLookup> modelLookup
      If a Pojo can't be simply bound to a sling resource type or no resource types exist for the resource then pass this lookup class back and programmatically return the Pojos to use.
      java.lang.String resourceType
      The sling:resourcetype to bind this Model to.
      java.lang.String[] type
      Returns a list of classes that will be used when Siren serializes this Pojo to JS.
    • Element Detail

      • category

        java.lang.String category
        The category this API belongs to is the first token in the URL after the api root. This allows different Pojos to represent the same resource types differently based on context.
        Returns:
        the category this belongs in
      • resourceType

        java.lang.String resourceType
        The sling:resourcetype to bind this Model to. This does not use isA to determine hierarchy for now it only matches on the string value.
        Returns:
        the resource type to bind to
        Default:
        ""
      • type

        java.lang.String[] type
        Returns a list of classes that will be used when Siren serializes this Pojo to JS.
        Returns:
        array of strings for the class of this object
        Default:
        {"default"}
      • modelLookup

        java.lang.Class<? extends ModelLookup> modelLookup
        If a Pojo can't be simply bound to a sling resource type or no resource types exist for the resource then pass this lookup class back and programmatically return the Pojos to use.
        Returns:
        class that will manage the lookups for this model
        Default:
        com.adobe.granite.haf.apimodel.impl.NullModelLookup.class
      • defaultConverterMediaType

        java.lang.String defaultConverterMediaType
        The default media type to use to find a HypermediaConverter to serialize the model. This will be used if the accepts header in the request doesn't request a specific media type that can be satisfied by one of the registered converters in the system.
        Returns:
        The media type used to look up the HypermediaConverter to use as a default.
        Default:
        ""
      • isDefault

        boolean isDefault
        Mark this as the default model for the category. If no model is found in the resource type registration or in the model lookup calls a model with this attribute set to true will be used. Only one default model is allowed per category.
        Returns:
        if the model is the default
        Default:
        false
      • modelClass

        java.lang.Class<?> modelClass
        Use this to signal to the framework to managed this object via a different interface. This is especially useful if this model also uses SlingModels. This value should track one of the adapters registrations.
        Returns:
        the model class
        Default:
        java.lang.Object.class