Class Fields
java.lang.Object
org.eclipse.jetty.util.Fields
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given value to a field with the given name, creating aFields.Fieldis none exists for the given name.voidclear()Empties thisFieldsinstance from all fieldsbooleangetNames()intgetSize()inthashCode()booleanisEmpty()iterator()private StringnormalizeName(String name) voidInserts or replaces the given name/value pair as a single-valuedFields.Field.voidput(Fields.Field field) Inserts or replaces the givenFields.Field, mapped to thefield's nameRemoves theFields.Fieldwith the given nametoString()Methods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
caseSensitive
private final boolean caseSensitive -
fields
-
-
Constructor Details
-
Fields
-
Fields
-
Fields
-
-
Method Details
-
equals
-
hashCode
-
getNames
-
normalizeName
-
get
- Parameters:
name- the field name- Returns:
- the
Fields.Fieldwith the given name, or null if no such field exists
-
put
Inserts or replaces the given name/value pair as a single-valued
Fields.Field.- Parameters:
name- the field namevalue- the field value
-
put
Inserts or replaces the given
Fields.Field, mapped to thefield's name- Parameters:
field- the field to put
-
add
Adds the given value to a field with the given name, creating a
Fields.Fieldis none exists for the given name.- Parameters:
name- the field namevalue- the field value to add
-
remove
Removes the
Fields.Fieldwith the given name- Parameters:
name- the name of the field to remove- Returns:
- the removed field, or null if no such field existed
-
clear
-
isEmpty
public boolean isEmpty()- Returns:
- whether this
Fieldsinstance is empty
-
getSize
public int getSize()- Returns:
- the number of fields
-
iterator
- Specified by:
iteratorin interfaceIterable<Fields.Field>- Returns:
- an iterator over the
Fields.Fields present in this instance
-
toString
-