Class HalLinkRelation

java.lang.Object
org.springframework.hateoas.mediatype.hal.HalLinkRelation
All Implemented Interfaces:
org.springframework.context.MessageSourceResolvable, LinkRelation

public class HalLinkRelation extends Object implements LinkRelation, org.springframework.context.MessageSourceResolvable
Value object for HAL based LinkRelation, i.e. a relation that can be curied.
Author:
Oliver Drotbohm
  • Field Details

  • Method Details

    • of

      public static HalLinkRelation of(LinkRelation relation)
      Returns a HalLinkRelation for the given general LinkRelation.
      Parameters:
      relation - must not be null.
      Returns:
    • curied

      public static HalLinkRelation curied(String curie, String rel)
      Creates a new HalLinkRelation for a curied relation.
      Parameters:
      curie - the curie, must not be null or empty.
      rel - the link relation to be used, must not be null.
      Returns:
    • uncuried

      public static HalLinkRelation uncuried(String rel)
      Creates a new uncuried HalLinkRelation.
      Parameters:
      rel - the link relation to be used, must not be null.
      Returns:
    • curieBuilder

      public static HalLinkRelation.HalLinkRelationBuilder curieBuilder(String curie)
      Creates a new HalLinkRelation.HalLinkRelationBuilder for the given curie.
      Parameters:
      curie - must not be null or empty.
      Returns:
      will never be null.
    • curie

      public HalLinkRelation curie(String curie)
      Creates a new HalLinkRelation curied to the given value.
      Parameters:
      curie - must not be null or empty.
      Returns:
    • curieIfUncuried

      public HalLinkRelation curieIfUncuried(String curie)
      Returns a curied HalLinkRelation either using the existing curie or the given one if previously uncuried.
      Parameters:
      curie - must not be null or empty.
      Returns:
    • isCuried

      public boolean isCuried()
      Returns whether the link relation is curied.
      Returns:
    • map

      public HalLinkRelation map(Function<String,String> mapper)
      Description copied from interface: LinkRelation
      Returns a new LinkRelation with its relation mapped by the given function, unless it is an IANA one. Implementors are encouraged to override this method to redeclare the return type to be itself.
      Specified by:
      map in interface LinkRelation
      Parameters:
      mapper - must not be null.
      Returns:
      See Also:
    • value

      public String value()
      Description copied from interface: LinkRelation
      Return the link relation's value.
      Specified by:
      value in interface LinkRelation
    • getCodes

      public String @NonNull [] getCodes()
      Specified by:
      getCodes in interface org.springframework.context.MessageSourceResolvable
    • getDefaultMessage

      public @NonNull String getDefaultMessage()
      Specified by:
      getDefaultMessage in interface org.springframework.context.MessageSourceResolvable
    • getLocalPart

      public String getLocalPart()
    • equals

      public boolean equals(@Nullable 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