Class Resource

java.lang.Object
org.forgerock.api.models.Resource

public final class Resource extends Object
Class that represents the Resource type in API descriptor.

Resources may be either a reference to another Resource that will be defined elsewhere in the API Descriptor, or a described resource. If a Reference is provided, then none of the other fields may be used, and if any of the other fields are used, a reference may not be provided.

  • Method Details

    • getResourceSchema

      public Schema getResourceSchema()
      Getter of resource schema.
      Returns:
      Resource schema
    • getTitle

      public LocalizableString getTitle()
      Getter of title.
      Returns:
      Title
    • getDescription

      public LocalizableString getDescription()
      Getter of description.
      Returns:
      Description
    • getCreate

      public Create getCreate()
      Getter of Create.
      Returns:
      Create
    • getRead

      public Read getRead()
      Getter of Read.
      Returns:
      Read
    • getUpdate

      public Update getUpdate()
      Getter of Update.
      Returns:
      Update
    • getDelete

      public Delete getDelete()
      Getter of Delete.
      Returns:
      Delete
    • getPatch

      public Patch getPatch()
      Getter of Patch.
      Returns:
      Patch
    • getActions

      public Action[] getActions()
      Getter of actions.
      Returns:
      Actions
    • getQueries

      public Query[] getQueries()
      Getter of queries.
      Returns:
      Queries
    • getSubresources

      public SubResources getSubresources()
      Getter of sub-resources.
      Returns:
      Sub-resources
    • getReference

      public Reference getReference()
      Gets the reference.
      Returns:
      The reference.
    • getItems

      public Items getItems()
      Getter of items.
      Returns:
      Items
    • isMvccSupported

      public Boolean isMvccSupported()
      Informs if MVCC is supported.
      Returns:
      true if MVCC is supported and false otherwise
    • getParameters

      public Parameter[] getParameters()
      Getter of the parameters array.
      Returns:
      Parameters
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • resource

      public static Resource.Builder resource()
      Create a new Builder for Resoruce.
      Returns:
      Builder
    • fromAnnotatedType

      public static Resource fromAnnotatedType(Class<?> type, Resource.AnnotatedTypeVariant variant, ApiDescription descriptor)
      Build a Resource from an annotated request handler.
      Parameters:
      type - The annotated type.
      variant - The annotated type variant.
      descriptor - The root descriptor to add definitions to.
      Returns:
      The built Resource object.
    • fromAnnotatedType

      public static Resource fromAnnotatedType(Class<?> type, Resource.AnnotatedTypeVariant variant, SubResources subResources, ApiDescription descriptor, Parameter... extraParameters)
      Build a Resource from an annotated request handler.
      Parameters:
      type - The annotated type.
      variant - The annotated type variant.
      subResources - The sub resources object to be included, if any sub-resources exist, or null.
      descriptor - The root descriptor to add definitions to.
      extraParameters - Extra parameters not from the resource annotation.
      Returns:
      The built Resource object.
    • fromAnnotatedType

      public static Resource fromAnnotatedType(Class<?> type, Resource.AnnotatedTypeVariant variant, Items items, ApiDescription descriptor, Parameter... extraParameters)
      Build a Resource from an annotated request handler.
      Parameters:
      type - The annotated type.
      variant - The annotated type variant.
      items - The items definition for a collection variant, or null.
      descriptor - The root descriptor to add definitions to.
      extraParameters - Extra parameters not from the resource annotation.
      Returns:
      The built Resource object.