public class NameValuePairSupplier extends Object implements Iterable<NameValuePair>
NameValuePair
objects.
This class is thread safe.Modifier and Type | Class and Description |
---|---|
static class |
NameValuePairSupplier.Null
Represents no header supplier
|
Constructor and Description |
---|
NameValuePairSupplier() |
Modifier and Type | Method and Description |
---|---|
NameValuePairSupplier |
add(NameValuePair h)
Add a name-value pair to this supplier.
|
NameValuePairSupplier |
add(NameValuePairSupplier h)
Add a supplier to this supplier.
|
NameValuePairSupplier |
add(String name,
Object value)
Appends the specified name/value pair to the end of this list.
|
NameValuePairSupplier |
add(String name,
Object value,
HttpPartType partType,
HttpPartSerializerSession serializer,
HttpPartSchema schema,
boolean skipIfEmpty)
Appends the specified name/value pair to the end of this list.
|
NameValuePairSupplier |
add(String name,
Supplier<?> value)
Appends the specified name/value pair to the end of this list using a value supplier.
|
static NameValuePairSupplier |
create()
Convenience creator.
|
Iterator<NameValuePair> |
iterator() |
static NameValuePairSupplier |
of()
Creates an empty instance.
|
static NameValuePairSupplier |
of(Collection<NameValuePair> pairs)
Creates an instance initialized with the specified pairs.
|
static NameValuePairSupplier |
of(Object... values)
Convenience creator.
|
static NameValuePairSupplier |
ofPairs(Object... parameters)
Creates an instance initialized with the specified pairs.
|
NameValuePairSupplier |
resolving()
Allows values to contain SVL variables.
|
NameValuePairSupplier |
resolving(VarResolver varResolver)
Allows values to contain SVL variables.
|
NameValuePair[] |
toArray()
Returns these pairs as an array.
|
<T extends NameValuePair> |
toArray(T[] array)
Returns these pairs as an array.
|
String |
toString()
Returns this list as a URL-encoded custom query.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public NameValuePairSupplier()
public static NameValuePairSupplier create()
NameValuePairSupplier
object.public static NameValuePairSupplier of()
public static NameValuePairSupplier of(Collection<NameValuePair> pairs)
pairs
- The pairs to add to this list.public static NameValuePairSupplier ofPairs(Object... parameters)
parameters
- Initial list of parameters.
RuntimeException
- If odd number of parameters were specified.public static NameValuePairSupplier of(Object... values)
values
- The values to populate this supplier with.
NameValuePairSupplier
object.public NameValuePairSupplier resolving()
Resolves variables in values when using the following methods:
ofPairs(Object...)
add(String,Object)
add(String,Supplier<?>)
add(String,Object,HttpPartType,HttpPartSerializerSession,HttpPartSchema,boolean)
Uses VarResolver.DEFAULT
to resolve variables.
public NameValuePairSupplier resolving(VarResolver varResolver)
Resolves variables in values when using the following methods:
varResolver
- The variable resolver to use for resolving variables.public NameValuePairSupplier add(NameValuePair h)
h
- The name-value pair to add. public NameValuePairSupplier add(NameValuePairSupplier h)
h
- The supplier to add. public NameValuePairSupplier add(String name, Object value)
The pair is added as a BasicNameValuePair
.
name
- The pair name.value
- The pair value.public NameValuePairSupplier add(String name, Supplier<?> value)
The pair is added as a BasicNameValuePair
.
Value is re-evaluated on each call to BasicNameValuePair.getValue()
.
name
- The pair name.value
- The pair value supplier.public NameValuePairSupplier add(String name, Object value, HttpPartType partType, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean skipIfEmpty)
The value is converted to UON notation using the UrlEncodingSerializer
defined on the client.
name
- The pair name.value
- The pair value.partType
- The HTTP part type.serializer
- The serializer to use for serializing the value to a string value.schema
- The schema object that defines the format of the output.
HttpPartSchema.DEFAULT
.
OpenApiSerializer
).skipIfEmpty
- If value is a blank string, the value should return as public Iterator<NameValuePair> iterator()
iterator
in interface Iterable<NameValuePair>
public NameValuePair[] toArray()
public <T extends NameValuePair> T[] toArray(T[] array)
array
- The array to copy in to.Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.