java.lang.Object
com.broadleafcommerce.metadata.dsl.core.Link
All Implemented Interfaces:
Copyable<Link>, Serializable

public class Link extends Object implements Serializable, Copyable<Link>
Represents a link to a location within the client. This link may target the ID of a component, which will look for a matching ComponentRoute, or provide an explicit path to link to.
Author:
Nick Crum (ncrum)
See Also:
  • Constructor Details

    • Link

      public Link()
    • Link

      public Link(Link link)
  • Method Details

    • copy

      public Link copy()
      Specified by:
      copy in interface Copyable<Link>
      Returns:
      a deep copy of this instance
    • componentId

      public Link componentId(String componentId)
      Sets the component ID of the link.
      Parameters:
      componentId - the component ID
      Returns:
      the link
    • path

      public Link path(String path)
      Sets the path of the link.
      Parameters:
      path - the path
      Returns:
      the link
    • param

      public Link param(String name, Object value)
      Adds a parameter with the given name and value. The value may be a serializable object in which case the request parameter value will become serialized JSON.
      Parameters:
      name - the parameter name
      value - the parameter value
      Returns:
      the link
    • params

      public Link params(Map<String,Object> paramsToAdd)
      Adds a map of parameters. The value may be a serializable object in which case the request parameter value will become serialized JSON.
      Parameters:
      paramsToAdd - the params to add
      Returns:
      the link
    • self

      protected Link self()
    • getComponentId

      public String getComponentId()
      The ID of the Component targeted by a ComponentRoute that this will provide a link to.
    • getPath

      public String getPath()

      Alternative to componentId to provide a static path as a link, e.g. "/products/:id". This will take second priority to componentId if you need to statically reference a path.

      This supports any valid URL path that https://github.com/pillarjs/path-to-regexp/tree/v1.7.0 understands, e.g. "/products", "/products/:id", and "/categories/:id?" are all valid URL paths. Must start with a slash, and optionally may include any path parameters as necessary.

    • getParams

      public Map<String,Object> getParams()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object