Class Link
- 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 matchingComponentRoute, or provide an explicit path to link to.- Author:
- Nick Crum (ncrum)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)LinkcomponentId(String componentId)Sets the component ID of the link.Linkcopy()booleanequals(Object o)StringgetComponentId()The ID of theComponenttargeted by aComponentRoutethat this will provide a link to.Map<String,Object>getParams()StringgetPath()Alternative tocomponentIdto provide a static path as a link, e.g.inthashCode()Linkparam(String name, Object value)Adds a parameter with the given name and value.Linkparams(Map<String,Object> paramsToAdd)Adds a map of parameters.Linkpath(String path)Sets the path of the link.protected Linkself()
-
-
-
Constructor Detail
-
Link
public Link()
-
Link
public Link(Link link)
-
-
Method Detail
-
copy
public Link copy()
-
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 namevalue- 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 theComponenttargeted by aComponentRoutethat this will provide a link to.
-
getPath
public String getPath()
Alternative to
componentIdto provide a static path as a link, e.g. "/products/:id". This will take second priority tocomponentIdif 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.
-
canEqual
protected boolean canEqual(Object other)
-
-