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 boolean
canEqual(Object other)
Link
componentId(String componentId)
Sets the component ID of the link.Link
copy()
boolean
equals(Object o)
String
getComponentId()
The ID of theComponent
targeted by aComponentRoute
that this will provide a link to.Map<String,Object>
getParams()
String
getPath()
Alternative tocomponentId
to provide a static path as a link, e.g.int
hashCode()
Link
param(String name, Object value)
Adds a parameter with the given name and value.Link
params(Map<String,Object> paramsToAdd)
Adds a map of parameters.Link
path(String path)
Sets the path of the link.protected Link
self()
-
-
-
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 theComponent
targeted by aComponentRoute
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 tocomponentId
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.
-
canEqual
protected boolean canEqual(Object other)
-
-