Class JsonApiLink

java.lang.Object
org.apache.juneau.bean.jsonapi.JsonApiLink

@Marshalled public class JsonApiLink extends Object
Represents a JSON:API Link Object as defined by JSON:API v1.1 § Links.

Per the spec, each links entry may be either a JSON string URL or a JSON object with these members: href (required URI), rel, describedby, title, type (media-type hint), hreflang (language tag), and meta. The single-vs-object union is handled by JsonApiLinkOrStringSwap, applied via field-level @BeanProp("links") @Swap(...) on every type carrying a links map.

See Also:
  • Constructor Details

    • JsonApiLink

      public JsonApiLink()
      Default constructor.
    • JsonApiLink

      public JsonApiLink(String href)
      Convenience constructor with the required href field.
      Parameters:
      href - The link target URI. Can be null to leave the property unset.
  • Method Details

    • getHref

      public String getHref()
      Bean property getter: href.
      Returns:
      The value of the href property, or null if it is not set.
    • setHref

      public JsonApiLink setHref(String value)
      Bean property setter: href.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • getRel

      public String getRel()
      Bean property getter: rel.
      Returns:
      The value of the rel property, or null if it is not set.
    • setRel

      public JsonApiLink setRel(String value)
      Bean property setter: rel.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • getDescribedby

      Bean property getter: describedby.
      Returns:
      The value of the describedby property, or null if it is not set.
    • setDescribedby

      Bean property setter: describedby.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • getTitle

      public String getTitle()
      Bean property getter: title.
      Returns:
      The value of the title property, or null if it is not set.
    • setTitle

      public JsonApiLink setTitle(String value)
      Bean property setter: title.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • getType

      public String getType()
      Bean property getter: type.

      Media-type hint for the target resource.

      Returns:
      The value of the type property, or null if it is not set.
    • setType

      public JsonApiLink setType(String value)
      Bean property setter: type.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • getHreflang

      public String getHreflang()
      Bean property getter: hreflang.
      Returns:
      The value of the hreflang property, or null if it is not set.
    • setHreflang

      public JsonApiLink setHreflang(String value)
      Bean property setter: hreflang.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • getMeta

      public Map<String,Object> getMeta()
      Bean property getter: meta.
      Returns:
      The value of the meta property, or null if it is not set.
    • setMeta

      public JsonApiLink setMeta(Map<String,Object> value)
      Bean property setter: meta.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • putMeta

      public JsonApiLink putMeta(String name, Object value)
      Convenience method to add a single meta entry.
      Parameters:
      name - The meta key. Can be null (LinkedHashMap tolerates a null key).
      value - The meta value. Can be null (stored as null).
      Returns:
      This object.
    • toString

      public String toString()
      Overrides:
      toString in class Object