Package org.springframework.hateoas
Class TemplateVariable
java.lang.Object
org.springframework.hateoas.TemplateVariable
- All Implemented Interfaces:
Serializable
A single template variable.
- Author:
- Oliver Gierke, JamesE Richardson
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The cardinality of theTemplateVariable
.static enum
An enumeration for all supported variable types. -
Constructor Summary
ConstructorDescriptionTemplateVariable
(String name, TemplateVariable.VariableType type) Creates a newTemplateVariable
with the given name and type.TemplateVariable
(String name, TemplateVariable.VariableType type, String description) -
Method Summary
Modifier and TypeMethodDescriptionasString()
Marks the current template variable as composite value.static TemplateVariable
compositeParameter
(String parameter) Deprecated.boolean
static TemplateVariable
Static helper to fashionTemplateVariable.VariableType.FRAGMENT
variables.getName()
getType()
Returns the type of theTemplateVariable
.boolean
Returns whether the variable has a description.int
hashCode()
boolean
Returns whether the currentTemplateVariable
is a composite one.boolean
Returns whether the currentTemplateVariable
is a singular one.limit
(int limit) static TemplateVariable
pathVariable
(String variable) Static helper to fashionTemplateVariable.VariableType.PATH_VARIABLE
variables.prepareAndEncode
(Object value) static TemplateVariable
requestParameter
(String parameter) Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM
variables.static TemplateVariable
requestParameterContinued
(String parameter) Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM_CONTINUED
variables.static TemplateVariable
reservedString
(String name) static TemplateVariable
Static helper to fashionTemplateVariable.VariableType.SEGMENT
variables.singular()
Marks the current template variable as singular value.toString()
-
Constructor Details
-
TemplateVariable
Creates a newTemplateVariable
with the given name and type.- Parameters:
name
- must not be null or empty.type
- must not be null.
-
TemplateVariable
-
-
Method Details
-
pathVariable
Static helper to fashionTemplateVariable.VariableType.PATH_VARIABLE
variables.- Parameters:
variable
- must not be null or empty.- Returns:
- Since:
- 1.1
-
requestParameter
Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM
variables.- Parameters:
parameter
- must not be null or empty.- Returns:
- Since:
- 1.1
-
requestParameterContinued
Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM_CONTINUED
variables.- Parameters:
parameter
- must not be null or empty.- Returns:
- Since:
- 1.1
-
segment
Static helper to fashionTemplateVariable.VariableType.SEGMENT
variables.- Parameters:
segment
- must not be null or empty.- Returns:
- Since:
- 1.1
-
fragment
Static helper to fashionTemplateVariable.VariableType.FRAGMENT
variables.- Parameters:
name
- must not be null or empty.- Returns:
- Since:
- 1.1
-
reservedString
-
compositeParameter
Deprecated.since 1.4, use actual parameter type and callcomposite()
on the instance instead.Static helper to fashionTemplateVariable.VariableType.COMPOSITE_PARAM
variables.- Parameters:
parameter
- must not be null or empty.- Returns:
- Since:
- 1.1
-
composite
Marks the current template variable as composite value.- Returns:
- Since:
- 1.4
-
singular
Marks the current template variable as singular value.- Returns:
- Since:
- 1.4
-
limit
-
isComposite
public boolean isComposite()Returns whether the currentTemplateVariable
is a composite one.- Returns:
- Since:
- 1.4
-
isSingular
public boolean isSingular()Returns whether the currentTemplateVariable
is a singular one.- Returns:
- Since:
- 1.4
-
hasDescription
public boolean hasDescription()Returns whether the variable has a description.- Returns:
-
toString
-
asString
-
getName
-
getType
Returns the type of theTemplateVariable
.- Returns:
- will never be null.
-
getDescription
-
expand
-
prepareAndEncode
-
equals
-
hashCode
public int hashCode()
-
composite()
on the instance instead.