Class AbstractResource<Impl extends AbstractResource>

java.lang.Object
io.micronaut.http.hateoas.AbstractResource<Impl>
Type Parameters:
Impl - An Abstract resource implementation
All Implemented Interfaces:
Resource
Direct Known Subclasses:
GenericResource, JsonError

@Produces("application/hal+json") @Introspected public abstract class AbstractResource<Impl extends AbstractResource> extends Object implements Resource
An abstract implementation of Resource.
Since:
1.1
Author:
Graeme Rocher
  • Constructor Details

    • AbstractResource

      public AbstractResource()
  • Method Details

    • link

      public Impl link(@Nullable CharSequence ref, @Nullable Link link)
      Add a link with the given reference.
      Parameters:
      ref - The reference
      link - The link
      Returns:
      This JsonError
    • link

      public Impl link(@Nullable CharSequence ref, @Nullable String link)
      Add a link with the given reference.
      Parameters:
      ref - The reference
      link - The link
      Returns:
      This JsonError
    • embedded

      public Impl embedded(CharSequence ref, Resource resource)
      Add an embedded resource with the given reference.
      Parameters:
      ref - The reference
      resource - The resource
      Returns:
      This JsonError
    • embedded

      public Impl embedded(CharSequence ref, Resource... resource)
      Add an embedded resource with the given reference.
      Parameters:
      ref - The reference
      resource - The resource
      Returns:
      This JsonError
    • embedded

      public Impl embedded(CharSequence ref, List<Resource> resourceList)
      Add an embedded resource with the given reference.
      Parameters:
      ref - The reference
      resourceList - The resources
      Returns:
      This JsonError
    • getLinks

      public OptionalMultiValues<Link> getLinks()
      Specified by:
      getLinks in interface Resource
      Returns:
      The links for this resource
    • getEmbedded

      public OptionalMultiValues<Resource> getEmbedded()
      Specified by:
      getEmbedded in interface Resource
      Returns:
      The embedded resources
    • setLinks

      @Internal public final void setLinks(Map<String,Object> links)
      Allows de-serializing of links with Jackson.
      Parameters:
      links - The links
    • setEmbedded

      @Internal public final void setEmbedded(Map<String,List<Resource>> embedded)
      Allows de-serializing of embedded with Jackson.
      Parameters:
      embedded - The links