Class PartList
- All Implemented Interfaces:
- Serializable,- Cloneable,- Iterable<NameValuePair>,- Collection<NameValuePair>,- List<NameValuePair>,- RandomAccess
- Direct Known Subclasses:
- PartList.Void
Example
   PartList 
See Also:
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classRepresents no part list in annotations.
- 
Field SummaryFields inherited from class java.util.AbstractListmodCount
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAppends the specified part to the end of this list.Appends the specified part to the end of this list using a value supplier.append(List<NameValuePair> values) Adds the specified parts to the end of the parts in this list.append(NameValuePair value) Adds the specified part to the end of the parts in this list.append(NameValuePair... values) Adds the specified parts to the end of the parts in this list.caseInsensitive(boolean value) Specifies that the parts in this list should be treated as case-sensitive.booleanTests if parts with the given name are contained within this list.copy()Makes a copy of this list.static PartListcreate()Instantiates a new part list.forEach(String name, Consumer<NameValuePair> action) Performs an action on all parts in this list with the specified name.forEach(Predicate<NameValuePair> filter, Consumer<NameValuePair> action) Performs an action on all the matching parts in this list.forEachValue(String name, Consumer<String> action) Performs an action on the values of all matching parts in this list.forEachValue(Predicate<NameValuePair> filter, Consumer<String> action) Performs an action on the values for all matching parts in this list.<T> Optional<T>Gets a part representing all of the part values with the given name.Gets a part representing all of the part values with the given name.<T> Optional<T>Gets a part representing all of the part values with the given name.getAll()Gets all of the parts.Gets all of the parts with the given name.Gets the first part with the given name.Gets the last part with the given name.String[]Returns all the string values for all parts with the specified name.static PartListof(List<NameValuePair> parts) Creates a newPartListinitialized with the specified parts.static PartListof(NameValuePair... parts) Creates a newPartListinitialized with the specified parts.static PartListCreates a newPartListinitialized with the specified name/value pairs.Returns an iterator over this list of parts.partIterator(String name) Returns an iterator over the parts with a given name in this list.Appends the specified part to the beginning of this list.Appends the specified part to the beginning of this list using a value supplier.prepend(List<NameValuePair> values) Adds the specified parts to the beginning of the parts in this list.prepend(NameValuePair value) Adds the specified part to the beginning of the parts in this list.prepend(NameValuePair... values) Adds the specified parts to the beginning of the parts in this list.Removes the part with the specified name from this list.Removes the part with the specified name from this list.remove(List<NameValuePair> values) Removes the specified parts from this list.remove(NameValuePair value) Removes the specified part from this list.remove(NameValuePair... values) Removes the specified parts from this list.Allows part values to contain SVL variables.resolving(VarResolver varResolver) Allows part values to contain SVL variables.Replaces the first occurrence of the parts with the same name.Replaces the first occurrence of the parts with the same name.set(List<NameValuePair> values) Replaces the first occurrence of the parts with the same name.set(NameValuePair value) Adds or replaces the part(s) with the same name.set(NameValuePair... values) Adds or replaces the part(s) with the same name.setDefault(String name, Object value) Replaces the first occurrence of the part with the same name.setDefault(String name, Supplier<?> value) Replaces the first occurrence of the headers with the same name.setDefault(List<NameValuePair> parts) Adds a collection of default parts.setDefault(NameValuePair... parts) Makes a copy of this list of parts and adds a collection of default parts.Specifies whether this bean should be unmodifiable.Returns a stream of the parts in this list with the specified name.toString()Returns this list as a URL-encoded custom query.Methods inherited from class org.apache.juneau.collections.ControlledArrayListadd, add, addAll, addAll, assertModifiable, clear, isModifiable, iterator, listIterator, listIterator, overrideAdd, overrideAdd, overrideAddAll, overrideAddAll, overrideClear, overrideIterator, overrideListIterator, overrideRemove, overrideRemove, overrideRemoveAll, overrideRemoveIf, overrideReplaceAll, overrideRetainAll, overrideSet, overrideSort, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, sort, subListMethods inherited from class java.util.ArrayListclone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, lastIndexOf, removeRange, size, spliterator, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollectioncontainsAllMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, stream, toArrayMethods inherited from interface java.util.ListcontainsAll
- 
Constructor Details- 
PartListpublic PartList()Constructor.
- 
PartListCopy constructor.- Parameters:
- copyFrom- The bean to copy.
 
 
- 
- 
Method Details- 
createInstantiates a new part list.- Returns:
- A new part list.
 
- 
ofCreates a newPartListinitialized with the specified parts.- Parameters:
- parts- The parts to add to the list.
 Can be- null .- null entries are ignored.
- Returns:
- A new unmodifiable instance, never null .
 
- 
ofCreates a newPartListinitialized with the specified parts.- Parameters:
- parts- The parts to add to the list.- null entries are ignored.
- Returns:
- A new unmodifiable instance, never null .
 
- 
ofPairsCreates a newPartListinitialized with the specified name/value pairs.ExamplePartList parts = PartList.ofPairs ("foo" , 1,"bar" ,true );- Parameters:
- pairs- Initial list of pairs.
 Must be an even number of parameters representing key/value pairs.
- Returns:
- A new instance.
- Throws:
- RuntimeException- If odd number of parameters were specified.
 
- 
copyMakes a copy of this list.- Returns:
- A new copy of this list.
 
- 
setDefaultAdds a collection of default parts.Default parts are set if they're not already in the list. - Parameters:
- parts- The list of default parts.
- Returns:
- This object.
 
- 
setDefaultMakes a copy of this list of parts and adds a collection of default parts.Default parts are set if they're not already in the list. - Parameters:
- parts- The list of default parts.
- Returns:
- A new list, or the same list if the parts were empty.
 
- 
setDefaultReplaces the first occurrence of the part with the same name.- Parameters:
- name- The header name.
- value- The header value.
- Returns:
- This object.
 
- 
setDefaultReplaces the first occurrence of the headers with the same name.- Parameters:
- name- The header name.
- value- The header value.
- Returns:
- This object.
 
- 
resolvingAllows part values to contain SVL variables.Resolves variables in part values when using the following methods: - append(String,Object)
- append(String,Supplier<?>)
- prepend(String,Object)
- prepend(String,Supplier<?>)
- set(String,Object)
- set(String,Supplier<?>)
 Uses VarResolver.DEFAULTto resolve variables.- Returns:
- This object.
 
- 
resolvingAllows part values to contain SVL variables.Resolves variables in part values when using the following methods: - Parameters:
- varResolver- The variable resolver to use for resolving variables.
- Returns:
- This object.
 
- 
caseInsensitiveSpecifies that the parts in this list should be treated as case-sensitive.The default behavior is case-sensitive. - Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
appendAdds the specified part to the end of the parts in this list.- Parameters:
- value- The part to add.- null values are ignored.
- Returns:
- This object.
 
- 
appendAppends the specified part to the end of this list.The part is added as a BasicPart.- Parameters:
- name- The part name.
- value- The part value.
- Returns:
- This object.
 
- 
appendAppends the specified part to the end of this list using a value supplier.The part is added as a BasicPart.Value is re-evaluated on each call to BasicPart.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
- Returns:
- This object.
 
- 
appendAdds the specified parts to the end of the parts in this list.- Parameters:
- values- The parts to add.- null values are ignored.
- Returns:
- This object.
 
- 
appendAdds the specified parts to the end of the parts in this list.- Parameters:
- values- The parts to add.- null values are ignored.
- Returns:
- This object.
 
- 
prependAdds the specified part to the beginning of the parts in this list.- Parameters:
- value- The part to add.- null values are ignored.
- Returns:
- This object.
 
- 
prependAppends the specified part to the beginning of this list.The part is added as a BasicPart.- Parameters:
- name- The part name.
- value- The part value.
- Returns:
- This object.
 
- 
prependAppends the specified part to the beginning of this list using a value supplier.The part is added as a BasicPart.Value is re-evaluated on each call to BasicPart.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
- Returns:
- This object.
 
- 
prependAdds the specified parts to the beginning of the parts in this list.- Parameters:
- values- The parts to add.- null values are ignored.
- Returns:
- This object.
 
- 
prependAdds the specified parts to the beginning of the parts in this list.- Parameters:
- values- The parts to add.- null values are ignored.
- Returns:
- This object.
 
- 
removeRemoves the specified part from this list.- Parameters:
- value- The part to remove.- null values are ignored.
- Returns:
- This object.
 
- 
removeRemoves the specified parts from this list.- Parameters:
- values- The parts to remove.- null values are ignored.
- Returns:
- This object.
 
- 
removeRemoves the specified parts from this list.- Parameters:
- values- The parts to remove.- null values are ignored.
- Returns:
- This object.
 
- 
removeRemoves the part with the specified name from this list.- Parameters:
- name- The part name.
- Returns:
- This object.
 
- 
removeRemoves the part with the specified name from this list.- Parameters:
- names- The part name.
- Returns:
- This object.
 
- 
setAdds or replaces the part(s) with the same name.If no part with the same name is found the given part is added to the end of the list. - Parameters:
- value- The part to replace.- null values are ignored.
- Returns:
- This object.
 
- 
setAdds or replaces the part(s) with the same name.If no part with the same name is found the given part is added to the end of the list. - Parameters:
- values- The part to replace.- null values are ignored.
- Returns:
- This object.
 
- 
setReplaces the first occurrence of the parts with the same name.- Parameters:
- name- The part name.
- value- The part value.
- Returns:
- This object.
 
- 
setReplaces the first occurrence of the parts with the same name.- Parameters:
- name- The part name.
- value- The part value.
- Returns:
- This object.
 
- 
setReplaces the first occurrence of the parts with the same name.If no part with the same name is found the given part is added to the end of the list. - Parameters:
- values- The parts to replace.- null values are ignored.
- Returns:
- This object.
 
- 
getFirstGets the first part with the given name.Part name comparison is case sensitive by default. - Parameters:
- name- The part name.
- Returns:
- The first matching part, or Optional.empty()if not found.
 
- 
getLastGets the last part with the given name.Part name comparison is case sensitive by default. - Parameters:
- name- The part name.
- Returns:
- The last matching part, or Optional.empty()if not found.
 
- 
getGets a part representing all of the part values with the given name.If more that one part with the given name exists the values will be combined with ", " as per RFC 2616 Section 4.2.- Parameters:
- name- The part name.
- Returns:
- A part with a condensed value, or Optional.empty()if no parts by the given name are present
 
- 
getGets a part representing all of the part values with the given name.If more that one part with the given name exists the values will be combined with ", " as per RFC 2616 Section 4.2.The implementation class must have a public constructor taking in one of the following argument lists: - X(String - value )
- X(Object - value )
- X(String - name , String- value )
- X(String - name , Object- value )
 ExampleBasicIntegerPart age =partList .get("age" , BasicIntegerPart.class );- Type Parameters:
- T- The part implementation class.
- Parameters:
- name- The part name.
- type- The part implementation class.
- Returns:
- A part with a condensed value or null if no parts by the given name are present
 
- 
getGets a part representing all of the part values with the given name.Same as get(String, Class)but the part name is pulled from the name or value attribute of theFormData/Query/Pathannotation.ExampleAge age =partList .get(Age.class );- Type Parameters:
- T- The part implementation class.
- Parameters:
- type- The part implementation class.
- Returns:
- A part with a condensed value or null if no parts by the given name are present
 
- 
getAllGets all of the parts.The returned array maintains the relative order in which the parts were added. Each call creates a new array not backed by this list. As a general rule, it's more efficient to use the other methods with consumers to get parts. - Returns:
- An array containing all parts, never null .
 
- 
getAllGets all of the parts with the given name.The returned array maintains the relative order in which the parts were added. Part name comparison is case sensitive by default. Parts with null values are ignored. Each call creates a new array not backed by this list. As a general rule, it's more efficient to use the other methods with consumers to get parts. - Parameters:
- name- The part name.
- Returns:
- An array containing all matching parts, never null .
 
- 
forEachValuePerforms an action on the values for all matching parts in this list.- Parameters:
- filter- A predicate to apply to each element to determine if it should be included. Can be- null .
- action- An action to perform on each element.
- Returns:
- This object.
 
- 
forEachValuePerforms an action on the values of all matching parts in this list.- Parameters:
- name- The part name.
- action- An action to perform on each element.
- Returns:
- This object.
 
- 
getValuesReturns all the string values for all parts with the specified name.- Parameters:
- name- The part name.
- Returns:
- An array containing all values.  Never null .
 
- 
containsTests if parts with the given name are contained within this list.Part name comparison is case insensitive. - Parameters:
- name- The part name.
- Returns:
- true if at least one part with the name is present.
 
- 
partIteratorReturns an iterator over this list of parts.- Returns:
- A new iterator over this list of parts.
 
- 
partIteratorReturns an iterator over the parts with a given name in this list.- Parameters:
- name- The name of the parts over which to iterate, or- null for all parts
- Returns:
- A new iterator over the matching parts in this list.
 
- 
forEachPerforms an action on all parts in this list with the specified name.This is the preferred method for iterating over parts as it does not involve creation or copy of lists/arrays. - Parameters:
- name- The parts name.
- action- An action to perform on each element.
- Returns:
- This object.
 
- 
forEachPerforms an action on all the matching parts in this list.This is the preferred method for iterating over parts as it does not involve creation or copy of lists/arrays. - Parameters:
- filter- A predicate to apply to each element to determine if it should be included. Can be- null .
- action- An action to perform on each element.
- Returns:
- This object.
 
- 
streamReturns a stream of the parts in this list with the specified name.This does not involve a copy of the underlying array of NameValuePair objects so should perform well.- Parameters:
- name- The part name.
- Returns:
- This object.
 
- 
toStringReturns this list as a URL-encoded custom query.- Overrides:
- toStringin class- AbstractCollection<NameValuePair>
 
- 
setUnmodifiableDescription copied from class:ControlledArrayListSpecifies whether this bean should be unmodifiable.When enabled, attempting to set any properties on this bean will cause an UnsupportedOperationException.- Overrides:
- setUnmodifiablein class- ControlledArrayList<NameValuePair>
- Returns:
- This object.
 
 
-