com.github.fge.uritemplate.vars.values
Class ListValue

java.lang.Object
  extended by com.github.fge.uritemplate.vars.values.VariableValue
      extended by com.github.fge.uritemplate.vars.values.ListValue

@Immutable
public final class ListValue
extends VariableValue

List variable value

Note that several methods (in this class or the enclosed ListValue.Builder class) can take any object as an argument. It is the caller's responsibility to ensure that these objects have a suitable Object.toString() .toString()} implementation.

While a public constructor exists, it is deprecated. Use one of the factory methods instead, or a ListValue.Builder (see newBuilder()).


Nested Class Summary
static class ListValue.Builder
          Builder class for a ListValue
 
Field Summary
 
Fields inherited from class com.github.fge.uritemplate.vars.values.VariableValue
BUNDLE
 
Method Summary
static
<T> VariableValue
copyOf(Iterable<T> iterable)
          Build a list value out of an existing iterable (list, set, other)
 List<String> getListValue()
          Get a list for this value
 boolean isEmpty()
          Tell whether this value is empty
static ListValue.Builder newBuilder()
          Create a new list value builder
static VariableValue of(Object first, Object... other)
          Build a list value out of a series of elements
 
Methods inherited from class com.github.fge.uritemplate.vars.values.VariableValue
getMapValue, getScalarValue, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newBuilder

public static ListValue.Builder newBuilder()
Create a new list value builder

Returns:
a builder

copyOf

public static <T> VariableValue copyOf(Iterable<T> iterable)
Build a list value out of an existing iterable (list, set, other)

This calls ListValue.Builder.addAll(Iterable) internally.

Type Parameters:
T - the type of iterable elements
Parameters:
iterable - the iterable
Returns:
a new list value

of

public static VariableValue of(Object first,
                               Object... other)
Build a list value out of a series of elements

This calls ListValue.Builder.add(Object, Object...) internally.

Parameters:
first - first element
other - other elements, if any
Returns:
a new list value

getListValue

public List<String> getListValue()
Description copied from class: VariableValue
Get a list for this value

Only valid for list values

Overrides:
getListValue in class VariableValue
Returns:
the list

isEmpty

public boolean isEmpty()
Description copied from class: VariableValue
Tell whether this value is empty

For strings, this tells whether the string itself is empty. For lists and maps, this tells whether the list or map have no elements/entries.

Specified by:
isEmpty in class VariableValue
Returns:
true if the value is empty