Package org.apache.juneau.http.part
Class BasicPart
java.lang.Object
org.apache.juneau.http.part.BasicPart
- All Implemented Interfaces:
NameValuePair,Headerable
- Direct Known Subclasses:
BasicBooleanPart,BasicCsvArrayPart,BasicDatePart,BasicIntegerPart,BasicLongPart,BasicStringPart,BasicUriPart,SerializedPart
Implementation of
NameValuePair for serializing POJOs as URL-encoded form post entries.
Provides the following features:
-
Values from
Suppliers. - Caching.
- Fluent setters.
- Fluent assertions.
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasHeader()Convert the object to aHeader.Provides an object for performing assertions against the name of this pair.Provides an object for performing assertions against the value of this pair.static booleanReturnstrue if thecast(Object)method can be used on the specified object.static NameValuePairUtility method for converting an arbitrary object to aNameValuePair.getName()Returns the raw value of the part.getValue()static BasicPartStatic creator.static BasicPartCreates aNameValuePairfrom a name/value pair string (e.g.toString()
-
Constructor Details
-
BasicPart
Constructor.- Parameters:
name- The part name.value- The POJO to serialize to The part value.
-
BasicPart
Copy constructor.- Parameters:
copyFrom- The object to copy.
-
-
Method Details
-
canCast
Returnstrue if thecast(Object)method can be used on the specified object.- Parameters:
o- The object to check.- Returns:
true if thecast(Object)method can be used on the specified object.
-
cast
Utility method for converting an arbitrary object to aNameValuePair.- Parameters:
o- The object to cast or convert to aNameValuePair.- Returns:
- Either the same object cast as a
NameValuePairor converted to aNameValuePair.
-
of
Static creator.- Parameters:
name- The part name.value- The part value.- Returns:
- A new
BasicPartobject.
-
ofPair
Creates aNameValuePairfrom a name/value pair string (e.g."Foo: bar" )- Parameters:
pair- The pair string.- Returns:
- A new
NameValuePairobject.
-
asHeader
Description copied from interface:HeaderableConvert the object to aHeader.- Specified by:
asHeaderin interfaceHeaderable- Returns:
- The object converted to a
Header.
-
assertName
Provides an object for performing assertions against the name of this pair.- Returns:
- An object for performing assertions against the name of this pair.
-
assertValue
Provides an object for performing assertions against the value of this pair.- Returns:
- An object for performing assertions against the value of this pair.
-
getName
- Specified by:
getNamein interfaceNameValuePair
-
getRawValue
Returns the raw value of the part.- Returns:
- The raw value of the part.
-
getValue
- Specified by:
getValuein interfaceNameValuePair
-
toString
-