Class HalLink.Builder

java.lang.Object
com.helixframework.api.contract.HalLink.Builder
Enclosing class:
HalLink

public static class HalLink.Builder extends Object
  • Method Details

    • href

      public HalLink.Builder href(String href)
      Sets the href (URL) for the link.
      Parameters:
      href - The URL to set
      Returns:
      This builder instance
    • templated

      public HalLink.Builder templated(boolean templated)
      Marks the href as a URI template.
      Parameters:
      templated - A boolean indicating if the href is a URI template
      Returns:
      This builder instance
    • templated

      public HalLink.Builder templated()
      Marks the href as a URI template.
      Returns:
      This builder instance
    • type

      public HalLink.Builder type(String type)
      Sets the media type of the target resource.
      Parameters:
      type - The media type to set
      Returns:
      This builder instance
    • deprecation

      public HalLink.Builder deprecation(String deprecation)
      Sets the deprecation URL that provides information about why the link is deprecated.
      Parameters:
      deprecation - The deprecation URL to set
      Returns:
      This builder instance
    • name

      public HalLink.Builder name(String name)
      Sets the name of the link.
      Parameters:
      name - The name to set
      Returns:
      This builder instance
    • profile

      public HalLink.Builder profile(String profile)
      Sets the profile URL that provides documentation about the link relation type.
      Parameters:
      profile - The profile URL to set
      Returns:
      This builder instance
    • title

      public HalLink.Builder title(String title)
      Sets the human-readable title of the link.
      Parameters:
      title - The title to set
      Returns:
      This builder instance
    • hreflang

      public HalLink.Builder hreflang(String hreflang)
      Sets the language tag of the target resource.
      Parameters:
      hreflang - The language tag to set
      Returns:
      This builder instance
    • hreflang

      public HalLink.Builder hreflang(Locale locale)
      Sets the language tag of the target resource using a Locale object.
      Parameters:
      locale - The locale to derive the language tag from
      Returns:
      This builder instance
    • hreflang

      public HalLink.Builder hreflang(String language, String country)
      Sets the language tag of the target resource using language and country codes.
      Parameters:
      language - The language code
      country - The country code
      Returns:
      This builder instance
    • method

      public HalLink.Builder method(String method)
      Sets the HTTP method for this link in the metadata.
      Parameters:
      method - The HTTP method to set
      Returns:
      This builder instance
    • method

      public HalLink.Builder method(HalLink.HttpMethod method)
      Sets the HTTP method for this link in the metadata.
      Parameters:
      method - The HTTP method to set
      Returns:
      This builder instance
    • meta

      public HalLink.Builder meta(Map<String,Object> meta)
      Sets the metadata map for this link.
      Parameters:
      meta - The metadata map to set
      Returns:
      This builder instance
    • meta

      public HalLink.Builder meta(String key, Object value)
      Adds a key-value pair to the metadata map.
      Parameters:
      key - The metadata key
      value - The metadata value
      Returns:
      This builder instance
      Throws:
      IllegalArgumentException - if key is null
    • build

      public HalLink build()
      Builds and returns a new HalLink instance with the configured properties.
      Returns:
      A new HalLink instance
      Throws:
      IllegalStateException - if href is null or empty