com.github.fge.uritemplate.render
Class MultiValueRenderer

java.lang.Object
  extended by com.github.fge.uritemplate.render.ValueRenderer
      extended by com.github.fge.uritemplate.render.MultiValueRenderer
Direct Known Subclasses:
ListRenderer, MapRenderer

public abstract class MultiValueRenderer
extends ValueRenderer

Base abstract class for list and map rendering

The rendering algorithm for both is very similar. Common logic is delegated to this class.

The main rendering method essentially delegates to other rendering methods since the actual result is highly dependent on both the varspec modifier and expression type.


Field Summary
protected static Joiner COMMA
           
 
Fields inherited from class com.github.fge.uritemplate.render.ValueRenderer
ifEmpty, named
 
Constructor Summary
protected MultiValueRenderer(ExpressionType type)
           
 
Method Summary
 List<String> render(VariableSpec varspec, VariableValue value)
          Render a value given a varspec and value
protected abstract  List<String> renderNamedExploded(String varname, VariableValue value)
          Rendering method for named expressions and exploded varspecs
protected abstract  List<String> renderNamedNormal(String varname, VariableValue value)
          Rendering method for named expressions and non exploded varspecs
protected abstract  List<String> renderUnnamedExploded(VariableValue value)
          Rendering method for non named expressions and exploded varspecs
protected abstract  List<String> renderUnnamedNormal(VariableValue value)
          Rendering method for non named expressions and non exploded varspecs
 
Methods inherited from class com.github.fge.uritemplate.render.ValueRenderer
pctEncode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMA

protected static final Joiner COMMA
Constructor Detail

MultiValueRenderer

protected MultiValueRenderer(ExpressionType type)
Method Detail

render

public final List<String> render(VariableSpec varspec,
                                 VariableValue value)
                          throws URITemplateException
Description copied from class: ValueRenderer
Render a value given a varspec and value

Specified by:
render in class ValueRenderer
Parameters:
varspec - the varspec
value - the matching variable value
Returns:
a list of rendered strings
Throws:
URITemplateException - illegal expansion

renderNamedExploded

protected abstract List<String> renderNamedExploded(String varname,
                                                    VariableValue value)
Rendering method for named expressions and exploded varspecs

Parameters:
varname - name of the variable (used in lists)
value - value of the variable
Returns:
list of rendered elements

renderUnnamedExploded

protected abstract List<String> renderUnnamedExploded(VariableValue value)
Rendering method for non named expressions and exploded varspecs

Parameters:
value - value of the variable
Returns:
list of rendered elements

renderNamedNormal

protected abstract List<String> renderNamedNormal(String varname,
                                                  VariableValue value)
Rendering method for named expressions and non exploded varspecs

Parameters:
varname - name of the variable (used in lists)
value - value of the variable
Returns:
list of rendered elements

renderUnnamedNormal

protected abstract List<String> renderUnnamedNormal(VariableValue value)
Rendering method for non named expressions and non exploded varspecs

Parameters:
value - value of the variable
Returns:
list of rendered elements