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 enumThe cardinality of theTemplateVariable.static enumAn enumeration for all supported variable types. -
Constructor Summary
ConstructorsConstructorDescriptionTemplateVariable(String name, TemplateVariable.VariableType type) Creates a newTemplateVariablewith 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 TemplateVariablecompositeParameter(String parameter) Deprecated.booleanstatic TemplateVariableStatic helper to fashionTemplateVariable.VariableType.FRAGMENTvariables.getName()getType()Returns the type of theTemplateVariable.booleanReturns whether the variable has a description.inthashCode()booleanReturns whether the currentTemplateVariableis a composite one.booleanReturns whether the currentTemplateVariableis a singular one.limit(int limit) static TemplateVariablepathVariable(String variable) Static helper to fashionTemplateVariable.VariableType.PATH_VARIABLEvariables.prepareAndEncode(Object value) static TemplateVariablerequestParameter(String parameter) Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAMvariables.static TemplateVariablerequestParameterContinued(String parameter) Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM_CONTINUEDvariables.static TemplateVariablereservedString(String name) static TemplateVariableStatic helper to fashionTemplateVariable.VariableType.SEGMENTvariables.singular()Marks the current template variable as singular value.toString()
-
Constructor Details
-
TemplateVariable
Creates a newTemplateVariablewith 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_VARIABLEvariables.- Parameters:
variable- must not be null or empty.- Returns:
- Since:
- 1.1
-
requestParameter
Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAMvariables.- Parameters:
parameter- must not be null or empty.- Returns:
- Since:
- 1.1
-
requestParameterContinued
Static helper to fashionTemplateVariable.VariableType.REQUEST_PARAM_CONTINUEDvariables.- Parameters:
parameter- must not be null or empty.- Returns:
- Since:
- 1.1
-
segment
Static helper to fashionTemplateVariable.VariableType.SEGMENTvariables.- Parameters:
segment- must not be null or empty.- Returns:
- Since:
- 1.1
-
fragment
Static helper to fashionTemplateVariable.VariableType.FRAGMENTvariables.- 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_PARAMvariables.- 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 currentTemplateVariableis a composite one.- Returns:
- Since:
- 1.4
-
isSingular
public boolean isSingular()Returns whether the currentTemplateVariableis 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.