|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.github.fge.uritemplate.render.ValueRenderer
public abstract class ValueRenderer
Main rendering class
The algorithm used for rendering is centered around this class,and is adapted from the algorithm suggested in the RFC's appendix.
Eventually, rendering can be viewed as joining a list of rendered strings with the expression type separator; if the resulting list is empty, the end result is the empty string; otherwise, it is the expression's prefix string (if any) followed by the joined list of rendered strings.
This class renders one variable value according to the expression type and value type. The rendering method returns a list, which can be empty.
ExpressionType
Field Summary | |
---|---|
protected String |
ifEmpty
Substitution string for an empty value/list member/map value |
protected boolean |
named
Whether variable values are named during expansion |
Constructor Summary | |
---|---|
protected |
ValueRenderer(ExpressionType type)
Constructor |
Method Summary | |
---|---|
protected String |
pctEncode(String s)
Render a string value, doing character percent-encoding where needed |
abstract List<String> |
render(VariableSpec varspec,
VariableValue value)
Render a value given a varspec and value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final boolean named
ExpressionType.isNamed()
protected final String ifEmpty
ExpressionType.getIfEmpty()
Constructor Detail |
---|
protected ValueRenderer(ExpressionType type)
type
- the expression typeMethod Detail |
---|
public abstract List<String> render(VariableSpec varspec, VariableValue value) throws URITemplateException
varspec
- the varspecvalue
- the matching variable value
URITemplateException
- illegal expansionprotected final String pctEncode(String s)
The character set on which to perform percent encoding is dependent on the expression type.
s
- the string to encode
ExpressionType.isRawExpand()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |