Class AbstractResource<Impl extends AbstractResource>

  • 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 java.lang.Object
    implements Resource
    An abstract implementation of Resource.
    Since:
    1.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Impl embedded​(java.lang.CharSequence ref, Resource resource)
      Add an embedded resource with the given reference.
      Impl embedded​(java.lang.CharSequence ref, Resource... resource)
      Add an embedded resource with the given reference.
      Impl embedded​(java.lang.CharSequence ref, java.util.List<Resource> resourceList)
      Add an embedded resource with the given reference.
      io.micronaut.core.value.OptionalMultiValues<Resource> getEmbedded()  
      io.micronaut.core.value.OptionalMultiValues<Link> getLinks()  
      Impl link​(java.lang.CharSequence ref, Link link)
      Add a link with the given reference.
      Impl link​(java.lang.CharSequence ref, java.lang.String link)
      Add a link with the given reference.
      void setEmbedded​(java.util.Map<java.lang.String,​java.util.List<Resource>> embedded)
      Allows de-serializing of embedded with Jackson.
      void setLinks​(java.util.Map<java.lang.String,​java.lang.Object> links)
      Allows de-serializing of links with Jackson.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractResource

        public AbstractResource()
    • Method Detail

      • link

        public Impl link​(@Nullable
                         java.lang.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
                         java.lang.CharSequence ref,
                         @Nullable
                         java.lang.String link)
        Add a link with the given reference.
        Parameters:
        ref - The reference
        link - The link
        Returns:
        This JsonError
      • embedded

        public Impl embedded​(java.lang.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​(java.lang.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​(java.lang.CharSequence ref,
                             java.util.List<Resource> resourceList)
        Add an embedded resource with the given reference.
        Parameters:
        ref - The reference
        resourceList - The resources
        Returns:
        This JsonError
      • getLinks

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

        public io.micronaut.core.value.OptionalMultiValues<Resource> getEmbedded()
        Specified by:
        getEmbedded in interface Resource
        Returns:
        The embedded resources
      • setLinks

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

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