Interface Endpoint<E extends Endpoint<E>>

All Superinterfaces:
Copyable<E>, Serializable
All Known Subinterfaces:
PageableEndpoint<E>
All Known Implementing Classes:
AbstractEndpoint, DefaultEndpoint, DefaultPageableEndpoint

public interface Endpoint<E extends Endpoint<E>> extends Serializable, Copyable<E>
Represents the metadata for an endpoint.
Author:
Nick Crum (ncrum)
  • Method Details

    • getType

      @Nullable String getType()
    • getUri

      @Nullable String getUri()
    • getMethod

      @Nullable Endpoint.Method getMethod()
    • getScope

      @Nullable String getScope()
    • getParams

      Map<String,String> getParams()
    • getHeaders

      Map<String,Object> getHeaders()
    • getMapParams

      List<Mapping<?>> getMapParams()
    • getTransformRequestBody

      @Nullable TransformBody getTransformRequestBody()
    • getTransformResponseBody

      @Nullable TransformBody getTransformResponseBody()
    • getParent

      @Nullable Component<?> getParent()
    • setType

      void setType(String type)
    • setUri

      void setUri(String uri)
    • setMethod

      void setMethod(Endpoint.Method method)
    • setScope

      void setScope(String scope)
    • setParams

      void setParams(Map<String,String> params)
    • setHeaders

      void setHeaders(Map<String,Object> headers)
    • setMapParams

      void setMapParams(List<Mapping<?>> mapParams)
    • setTransformRequestBody

      void setTransformRequestBody(TransformBody transformRequestBody)
    • setTransformResponseBody

      void setTransformResponseBody(TransformBody transformResponseBody)
    • setParent

      void setParent(Component<?> parent)
    • self

      default E self()
      Used internally to grab this endpoint cast to Endpoint.
      Returns:
      this
    • type

      default E type(String type)
    • uri

      default E uri(String uri)
    • method

      default E method(Endpoint.Method method)
    • method

      default E method(String method)
    • get

      default E get()
    • post

      default E post()
    • put

      default E put()
    • patch

      default E patch()
    • delete

      default E delete()
    • scope

      default E scope(String... scope)
    • scopes

      default E scopes(Collection<String> scopes)
    • param

      default E param(String name, String valueOrTemplate)
    • params

      default E params(Map<String,String> params)
    • removeParam

      default E removeParam(String name)
    • clearParams

      default E clearParams()
    • header

      default E header(String name, Object valueOrTemplate)
    • headers

      default E headers(Map<String,Object> headers)
    • removeHeader

      default E removeHeader(String name)
    • clearHeaders

      default E clearHeaders()
    • mapParam

      default E mapParam(Mapping<?>... mappings)
    • mapParams

      default E mapParams(Collection<Mapping<?>> mappings)
    • removeMapParam

      default E removeMapParam(String id)
    • clearParamMappings

      default E clearParamMappings()
    • transformRequest

      default E transformRequest(TransformBody transformRequestBody)
    • transformRequest

      default E transformRequest(UnaryOperator<TransformBody> fn)
    • transformResponse

      default E transformResponse(TransformBody transformResponseBody)
    • transformResponse

      default E transformResponse(UnaryOperator<TransformBody> fn)
    • apply

      default E apply(Consumer<? super E> fn)
      Executes the provided function with this endpoint as an argument.
      Parameters:
      fn - the function
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • getAttributes

      default Map<String,Object> getAttributes()
      A key-value map used to provide additional metadata beyond the first-class properties. By default, this method returns a read-only empty map for backwards compatibility. Either extend AbstractEndpoint or ensure that your implementation overrides this default method.
      Returns:
      the attributes map
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • setAttributes

      default void setAttributes(Map<String,Object> attributes)
      Sets the attributes map. This is a no-op for backwards compatibility. Either extend AbstractEndpoint or ensure that your implementation overrides this default method.
      Parameters:
      attributes - the attributes map
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • attribute

      default E attribute(String key, @Nullable Object value)
      Adds an attributes with the provided key and value.
      Parameters:
      key - the key
      value - the value
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • removeAttribute

      default E removeAttribute(String key)
      Removes the attributes at the given key.
      Parameters:
      key - the key
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • hasAttribute

      default boolean hasAttribute(String key)
      Returns whether or not the attribute at the given key exists.
      Parameters:
      key - the key
      Returns:
      whether or not the attribute exists
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • getAttribute

      default Object getAttribute(String key)
      Retrieves the attribute at the given key.
      Parameters:
      key - the key
      Returns:
      the attribute value
      Throws:
      IllegalArgumentException - if no attribute exists at the key
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • getAttribute

      default <T> T getAttribute(String key, Class<T> clazz)
      Retrieves the attribute at the given key and casts to the provided type.
      Type Parameters:
      T - the type
      Parameters:
      key - the key
      clazz - the type of attribute
      Returns:
      the attribute value
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • findAttribute

      default Optional<Object> findAttribute(String key)
      Finds the attribute at the given key. Null-safe version of getAttribute(String).
      Parameters:
      key - the key
      Returns:
      an optional with the attribute value or empty
    • findAttribute

      default <T> Optional<T> findAttribute(String key, Class<T> type)
      Finds the attribute at the given key. Null-safe version of getAttribute(String).
      Parameters:
      key - the key
      Returns:
      an optional with the attribute value or empty
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • responseIsPartialState

      default E responseIsPartialState(boolean responseIsPartialState)
      Indicates that this endpoint's response will be a partial state that should be merged with the existing entity state, similar to a PATCH request. This is useful for APIs that do not support PATCH requests directly or that are backing external field groups on a different entity's form. In those cases, the parent entity state should be merged with the new state returned by the endpoint to maintain the full view state.
      Parameters:
      responseIsPartialState - Whether the response is a partial state that should be merged with the existing entity state.
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
      See Also:
    • responseIsPartialState

      default E responseIsPartialState()
      Convenience method that is the same as treatAsPatch(true).
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • getConditionals

      default List<Conditional<?>> getConditionals()
      A set of conditions used to indicate when this component should be rendered. This is most commonly used by form components to hide/show fields and grids depending on the form state.
      Returns:
      the set of conditionals
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • setConditionals

      default void setConditionals(List<Conditional<?>> conditionals)
      Sets the conditionals for this component.
      Parameters:
      conditionals - the conditionals
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • conditional

      default E conditional(Conditional<?>... conditionals)
      Adds one or more conditions to this component.
      Parameters:
      conditionals - the condition(s)
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • conditionals

      default E conditionals(List<Conditional<?>> conditionals)
      Adds one or more conditions to this component.
      Parameters:
      conditionals - the condition(s)
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2
    • clearConditionals

      default E clearConditionals()
      Clears the current conditions on this component.
      Returns:
      this
      Since:
      Metadata 2.0.8, Release Train 2.1.6, 2.2.2