de.knipp.rritoolkit
Class KVList.ValueImpl

java.lang.Object
  extended by de.knipp.rritoolkit.KVList.ValueImpl
All Implemented Interfaces:
KVList.Value, java.lang.Iterable<java.lang.String>
Enclosing class:
KVList

protected static class KVList.ValueImpl
extends java.lang.Object
implements KVList.Value

inner class that implements a value

Version:
$Revision: 14936 $
Author:
Klaus Malorny

Field Summary
private  java.util.List<java.lang.String> list
          list for multiple entries, may be null
private  java.lang.String value
          string value for a single entry, may be null
 
Constructor Summary
KVList.ValueImpl()
          constructor
KVList.ValueImpl(java.lang.String v)
          constructor
 
Method Summary
 void add(java.lang.String v)
          add the given string as a value
 void add(java.lang.String[] values)
          add all strings to the value
 void clear()
          clear the content
 int getCount()
          return the number of strings stored in the value
 java.lang.String getFirst()
          return the first value
 java.util.Iterator<java.lang.String> iterator()
          return an iterator for the value that iterates thru the strings
 void set(java.lang.String v)
          replace the contents of the value with the given one
 void set(java.lang.String[] values)
          replace the contents of the value with the given strings
 java.lang.String[] toArray(java.lang.String[] values)
          copy the contents into the given array.
 java.util.List<java.lang.String> toList()
          return the content as a list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

private java.lang.String value
string value for a single entry, may be null


list

private java.util.List<java.lang.String> list
list for multiple entries, may be null

Constructor Detail

KVList.ValueImpl

public KVList.ValueImpl()
constructor


KVList.ValueImpl

public KVList.ValueImpl(java.lang.String v)
constructor

Parameters:
v - the value to initialize with
Method Detail

add

public void add(java.lang.String v)
add the given string as a value

Parameters:
v - the value

add

public void add(java.lang.String[] values)
add all strings to the value

Parameters:
values - the values

clear

public void clear()
clear the content


set

public void set(java.lang.String v)
replace the contents of the value with the given one

Parameters:
v - the value

set

public void set(java.lang.String[] values)
replace the contents of the value with the given strings

Parameters:
values - the values

getCount

public int getCount()
return the number of strings stored in the value

Specified by:
getCount in interface KVList.Value
Returns:
the count

getFirst

public java.lang.String getFirst()
return the first value

Specified by:
getFirst in interface KVList.Value
Returns:
the first value or null if the value does not contain any string

toArray

public java.lang.String[] toArray(java.lang.String[] values)
copy the contents into the given array. If the array is null or too small, a new array is allocated

Specified by:
toArray in interface KVList.Value
Parameters:
values - the array, may be null
Returns:
the given array or a new array

toList

public java.util.List<java.lang.String> toList()
return the content as a list

Specified by:
toList in interface KVList.Value
Returns:
the list (read-only)

iterator

public java.util.Iterator<java.lang.String> iterator()
return an iterator for the value that iterates thru the strings

Specified by:
iterator in interface java.lang.Iterable<java.lang.String>
Returns:
the iterator


Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH