Class HalLink

java.lang.Object
com.helixframework.api.contract.HalLink

public final class HalLink extends Object
Represents a hypermedia link in the HAL (Hypertext Application Language) format. This class is immutable and provides properties to describe a hyperlink, along with additional metadata. The HalLink class is designed to work with JSON serialization/deserialization and follows the HAL link structure, including standard fields and optional custom metadata.
  • Method Details

    • builder

      public static HalLink.Builder builder(HalLink link)
      Creates a new builder instance initialized with values from an existing HalLink.
      Parameters:
      link - The HalLink to copy values from
      Returns:
      A new Builder instance
    • builder

      public static HalLink.Builder builder(String href)
      Creates a new builder instance with the specified href value.
      Parameters:
      href - The href URL to set
      Returns:
      A new Builder instance
    • builder

      public static HalLink.Builder builder(String href, HalLink.HttpMethod method)
      Creates a new builder instance with the specified href and HTTP method.
      Parameters:
      href - The href URL to set
      method - The HTTP method to associate with the link
      Returns:
      A new Builder instance
    • of

      public static HalLink of(String href)
      Creates a new HalLink instance with the specified href.
      Parameters:
      href - The href URL to set
      Returns:
      A new HalLink instance
    • of

      public static HalLink of(String href, HalLink.HttpMethod method)
      Creates a new HalLink instance with the specified href and HTTP method.
      Parameters:
      href - The href URL to set
      method - The HTTP method to associate with the link
      Returns:
      A new HalLink instance
    • getHref

      public String getHref()
      Gets the href (URL) of the link.
      Returns:
      The href URL
    • getTemplated

      public Boolean getTemplated()
      Indicates whether the href is a URI template.
      Returns:
      true if the href is templated, false otherwise
    • getType

      public String getType()
      Gets the media type of the target resource.
      Returns:
      The media type
    • getDeprecation

      public String getDeprecation()
      Gets the deprecation URL that provides information about why the link is deprecated.
      Returns:
      The deprecation URL
    • getName

      public String getName()
      Gets the name of the link.
      Returns:
      The link name
    • getProfile

      public String getProfile()
      Gets the profile URL that provides documentation about the link relation type.
      Returns:
      The profile URL
    • getTitle

      public String getTitle()
      Gets the human-readable title of the link.
      Returns:
      The link title
    • getHreflang

      public String getHreflang()
      Gets the language tag of the target resource.
      Returns:
      The language tag
    • getMeta

      public Map<String,Object> getMeta()
      Gets the additional metadata associated with the link.
      Returns:
      An unmodifiable map of metadata, or an empty map if no metadata exists
    • 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