Class HttpParts
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic final BasicPartCreates aBasicPartfrom a name/value pair string (e.g.static final BasicPartCreates a newBasicPartpart.static final BasicPartCreates a newBasicPartpart with a delayed value.static final BasicBooleanPartbooleanPart(String name, Boolean value) Creates a newBasicBooleanPartpart.static final BasicBooleanPartbooleanPart(String name, Supplier<Boolean> value) Creates a newBasicBooleanPartpart with a delayed value.static booleanReturnstrue if thecast(Object)method can be used on the specified object.static NameValuePairUtility method for converting an arbitrary object to aNameValuePair.static final BasicCsvArrayPartcsvArrayPart(String name, String... value) Creates a newBasicCsvArrayPartpart.static final BasicCsvArrayPartcsvArrayPart(String name, Supplier<String[]> value) Creates a newBasicCsvArrayPartpart with a delayed value.static final BasicDatePartdatePart(String name, ZonedDateTime value) Creates a newBasicDatePartpart.static final BasicDatePartdatePart(String name, Supplier<ZonedDateTime> value) Creates a newBasicDatePartpart with a delayed value.static Optional<ConstructorInfo>getConstructor(ClassMeta<?> type) Returns the constructor for the specified type.getName(HttpPartType partType, ClassMeta<?> type) Returns the name of the specified part type.static final BasicIntegerPartintegerPart(String name, Integer value) Creates a newBasicIntegerPartpart.static final BasicIntegerPartintegerPart(String name, Supplier<Integer> value) Creates a newBasicIntegerPartpart with a delayed value.static booleanisHttpPart(HttpPartType partType, ClassMeta<?> type) Returnstrue if the specified type is a part type.static final BasicLongPartCreates a newBasicLongPartpart.static final BasicLongPartCreates a newBasicLongPartpart with a delayed value.static final PartListpartList()Instantiates a newPartList.static PartListCreates a newPartListinitialized with the specified name/value pairs.static final PartListpartList(List<NameValuePair> parts) Creates a newPartListinitialized with the specified parts.static final PartListpartList(NameValuePair... parts) Creates a newPartListinitialized with the specified parts.static final SerializedPartserializedPart(String name, Object value) Creates a newSerializedPartpart.static final SerializedPartserializedPart(String name, Supplier<?> value) Creates a newSerializedPartpart with a delayed value.static final BasicStringPartstringPart(String name, String value) Creates a newBasicStringPartpart.static final BasicStringPartstringPart(String name, Supplier<String> value) Creates a newBasicStringPartpart with a delayed value.static final BasicUriPartCreates a newBasicUriPartpart.static final BasicUriPartCreates a newBasicUriPartpart with a delayed value.
- 
Constructor Details- 
HttpPartspublic HttpParts()
 
- 
- 
Method Details- 
booleanPartCreates a newBasicBooleanPartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any of the following:- Boolean- As-is.
- String- Parsed using- Boolean.parseBoolean(String).
- Anything else - Converted to String and then parsed.
 
- Returns:
- A new BasicBooleanPartobject, ornull if the name or value isnull .
 
- 
booleanPartCreates a newBasicBooleanPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be any of the following:- Boolean- As-is.
- String- Parsed using- Boolean.parseBoolean(String).
- Anything else - Converted to String and then parsed.
 
- Returns:
- A new BasicBooleanPartobject, ornull if the name or value isnull .
 
- 
csvArrayPartCreates a newBasicCsvArrayPartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any of the following:- String - A comma-delimited string.
- String[] - A pre-parsed value.
- Any other array type - Converted to String[] .
- Any Collection- Converted toString[] .
- Anything else - Converted to String .
 
- Returns:
- A new BasicCsvArrayPartobject, ornull if the name or value isnull .
 
- 
csvArrayPartCreates a newBasicCsvArrayPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be any of the following:- String - A comma-delimited string.
- String[] - A pre-parsed value.
- Any other array type - Converted to String[] .
- Any Collection- Converted toString[] .
- Anything else - Converted to String .
 
- Returns:
- A new BasicCsvArrayPartobject, ornull if the name or value isnull .
 
- 
datePartCreates a newBasicDatePartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any of the following:- String - An ISO-8601 formated string (e.g.- "1994-10-29T19:43:31Z" ).
- ZonedDateTime
- Calendar
- Anything else - Converted to String .
 
- Returns:
- A new BasicDatePartobject, ornull if the name or value isnull .
 
- 
datePartCreates a newBasicDatePartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be any of the following:- String - An ISO-8601 formated string (e.g.- "1994-10-29T19:43:31Z" ).
- ZonedDateTime
- Calendar
- Anything else - Converted to String .
 
- Returns:
- A new BasicDatePartobject, ornull if the name or value isnull .
 
- 
integerPartCreates a newBasicIntegerPartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any of the following:- Number- Converted to an integer using- Number.intValue().
- String- Parsed using- Integer.parseInt(String).
- Anything else - Converted to String .
 
- Returns:
- A new BasicIntegerPartobject, ornull if the name or value isnull .
 
- 
integerPartCreates a newBasicIntegerPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be any of the following:- Number- Converted to an integer using- Number.intValue().
- String- Parsed using- Integer.parseInt(String).
- Anything else - Converted to String .
 
- Returns:
- A new BasicIntegerPartobject, ornull if the name or value isnull .
 
- 
longPartCreates a newBasicLongPartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any of the following:- Number- Converted to a long using- Number.longValue().
- String- Parsed using- Long.parseLong(String).
- Anything else - Converted to String .
 
- Returns:
- A new BasicLongPartobject, ornull if the name or value isnull .
 
- 
longPartCreates a newBasicLongPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be any of the following:- Number- Converted to a long using- Number.longValue().
- String- Parsed using- Long.parseLong(String).
- Anything else - Converted to String .
 
- Returns:
- A new BasicLongPartobject, ornull if the name or value isnull .
 
- 
uriPartCreates a newBasicUriPartpart.- Parameters:
- name- The header name.
- value- The header value.
 Can be any of the following:- String
- Anything else - Converted to String then parsed.
 
- Returns:
- A new BasicUriPartobject, ornull if the name or value isnull .
 
- 
uriPartCreates a newBasicUriPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The header name.
- value- The header value supplier.
 Can be any of the following:- String
- Anything else - Converted to String then parsed.
 
- Returns:
- A new BasicUriPartobject, ornull if the name or value isnull .
 
- 
basicPartCreates aBasicPartfrom a name/value pair string (e.g."Foo: bar" )- Parameters:
- pair- The pair string.
- Returns:
- A new BasicPartobject.
 
- 
basicPartCreates a newBasicPartpart.- Parameters:
- name- The part name.
- value- The part value.
- Returns:
- A new BasicPartobject.
 
- 
basicPartCreates a newBasicPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
- Returns:
- A new BasicPartobject.
 
- 
stringPartCreates a newBasicStringPartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any of the following:- String
- Anything else - Converted to String then parsed.
 
- Returns:
- A new BasicStringPartobject, ornull if the name or value isnull .
 
- 
stringPartCreates a newBasicStringPartpart with a delayed value.Part value is re-evaluated on each call to NameValuePair.getValue().- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be any of the following:- String
- Anything else - Converted to String then parsed.
 
- Returns:
- A new BasicStringPartobject, ornull if the name or value isnull .
 
- 
serializedPartCreates a newSerializedPartpart.- Parameters:
- name- The part name.
- value- The part value.
 Can be any POJO.
- Returns:
- A new SerializedPartobject, nevernull .
 
- 
serializedPartCreates a newSerializedPartpart with a delayed value.- Parameters:
- name- The part name.
- value- The part value supplier.
 Can be a supplier of any POJO.
- Returns:
- A new SerializedPartobject, nevernull .
 
- 
partListInstantiates a newPartList.- Returns:
- A new part list.
 
- 
partListCreates 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 .
 
- 
partListCreates 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 .
 
- 
partListCreates a newPartListinitialized with the specified name/value pairs.- 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.
 
- 
getNameReturns the name of the specified part type.Gets the name from one of the following annotations: - Parameters:
- partType- The part type.
- type- The type to check.
- Returns:
- The part name.  Never null .
 
- 
isHttpPartReturnstrue if the specified type is a part type.A part type extends from either HeaderorNameValuePairor is annotated withHeader,Query,FormData, orPath.- Parameters:
- partType- The part type.
- type- The type to check.
- Returns:
- true if the specified type is a part type.
 
- 
getConstructorReturns the constructor for the specified type.Looks for one of the following constructors: - public T(String- name , String- value );
 - Parameters:
- type- The header type to find the constructor on.
- Returns:
- The constructor.  Never null .
 
- 
castUtility method for converting an arbitrary object to aNameValuePair.- Parameters:
- o- The object to cast or convert to a- NameValuePair.
- Returns:
- Either the same object cast as a NameValuePairor converted to aNameValuePair.
 
- 
canCastReturnstrue if thecast(Object)method can be used on the specified object.- Parameters:
- o- The object to check.
- Returns:
- true if the- cast(Object)method can be used on the specified object.
 
 
-