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
Nested ClassesModifier and TypeClassDescriptionstatic enum
The cardinality of theTemplateVariable
.static enum
An enumeration for all supported variable types. -
Constructor Summary
ConstructorsConstructorDescriptionTemplateVariable
(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.boolean
@Nullable String
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 fashionVariableType#PATH_VARIABLE
variables.@Nullable String
prepareAndEncode
(@Nullable 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 helper to fashionTemplateVariable.VariableType.RESERVED_STRING
variables.static TemplateVariable
Static helper to fashionVariableType#SEGMENT
variables.static TemplateVariable
Alias ofpathVariable(String)
.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 fashionVariableType#PATH_VARIABLE
variables.- Parameters:
variable
- must not be null or empty.- Returns:
- will never be null.
- Since:
- 1.1
-
simple
Alias ofpathVariable(String)
.- Parameters:
variable
- must not be null or empty.- Returns:
- will never be null.
- Since:
- 3.0
-
requestParameter
Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM
variables.- Parameters:
parameter
- must not be null or empty.- Returns:
- will never be null.
- Since:
- 1.1
-
requestParameterContinued
Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM_CONTINUED
variables.- Parameters:
parameter
- must not be null or empty.- Returns:
- will never be null.
- Since:
- 1.1
-
segment
Static helper to fashionVariableType#SEGMENT
variables.- Parameters:
segment
- must not be null or empty.- Returns:
- will never be null.
- Since:
- 1.1
-
fragment
Static helper to fashionTemplateVariable.VariableType.FRAGMENT
variables.- Parameters:
name
- must not be null or empty.- Returns:
- will never be null.
- Since:
- 1.1
-
reservedString
Static helper to fashionTemplateVariable.VariableType.RESERVED_STRING
variables.- Parameters:
name
- must not be null or empty.- Returns:
- will never be null.
- 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()
-