public class Fields extends Object implements Iterable<Fields.Field>
A container for name/value pairs, known as fields.
A Fields.Field is composed of a name string that can be case-sensitive
or case-insensitive (by specifying the option at the constructor) and
of a case-sensitive set of value strings.
The implementation of this class is not thread safe.
| Modifier and Type | Class and Description |
|---|---|
static class |
Fields.Field
A named list of string values.
|
| Constructor and Description |
|---|
Fields()
Creates an empty, modifiable, case insensitive
Fields instance. |
Fields(boolean caseSensitive)
Creates an empty, modifiable, case insensitive
Fields instance. |
Fields(Fields original,
boolean immutable)
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String name,
String value)
Adds the given value to a field with the given name,
creating a
Fields.Field is none exists for the given name. |
void |
clear()
Empties this
Fields instance from all fields |
boolean |
equals(Object obj) |
Fields.Field |
get(String name) |
Set<String> |
getNames() |
int |
getSize() |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<Fields.Field> |
iterator() |
void |
put(Fields.Field field)
Inserts or replaces the given
Fields.Field, mapped to the field's name |
void |
put(String name,
String value)
Inserts or replaces the given name/value pair as a single-valued
Fields.Field. |
Fields.Field |
remove(String name)
Removes the
Fields.Field with the given name |
String |
toString() |
public Fields()
Creates an empty, modifiable, case insensitive Fields instance.
Fields(Fields, boolean)public Fields(boolean caseSensitive)
Creates an empty, modifiable, case insensitive Fields instance.
caseSensitive - whether this Fields instance must be case sensitiveFields(Fields, boolean)public Fields.Field get(String name)
name - the field nameFields.Field with the given name, or null if no such field existspublic void put(String name, String value)
Inserts or replaces the given name/value pair as a single-valued Fields.Field.
name - the field namevalue - the field valuepublic void put(Fields.Field field)
Inserts or replaces the given Fields.Field, mapped to the field's name
field - the field to putpublic void add(String name, String value)
Adds the given value to a field with the given name,
creating a Fields.Field is none exists for the given name.
name - the field namevalue - the field value to addpublic Fields.Field remove(String name)
Removes the Fields.Field with the given name
name - the name of the field to removepublic boolean isEmpty()
Fields instance is emptypublic int getSize()
public Iterator<Fields.Field> iterator()
iterator in interface Iterable<Fields.Field>Fields.Fields present in this instanceCopyright © 1995-2015 Webtide. All Rights Reserved.