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
-
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 boolean
Returnstrue if thecast(Object)
method can be used on the specified object.static NameValuePair
Utility method for converting an arbitrary object to aNameValuePair
.getName()
Returns the raw value of the part.getValue()
static BasicPart
Static creator.static BasicPart
Creates aNameValuePair
from 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
-
of
Static creator.- Parameters:
name
- The part name.value
- The part value.- Returns:
- A new
BasicPart
object.
-
ofPair
Creates aNameValuePair
from a name/value pair string (e.g."Foo: bar" )- Parameters:
pair
- The pair string.- Returns:
- A new
NameValuePair
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
NameValuePair
or converted to aNameValuePair
.
-
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.
-
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.
-
asHeader
Description copied from interface:Headerable
Convert the object to aHeader
.- Specified by:
asHeader
in interfaceHeaderable
- Returns:
- The object converted to a
Header
.
-
getName
- Specified by:
getName
in interfaceNameValuePair
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
-
getRawValue
Returns the raw value of the part.- Returns:
- The raw value of the part.
-
toString
-