Package org.apache.juneau.http.part
Class SerializedPart
java.lang.Object
org.apache.juneau.http.part.BasicPart
org.apache.juneau.http.part.SerializedPart
- All Implemented Interfaces:
NameValuePair
,Headerable
Subclass of
NameValuePair
for serializing POJOs as URL-encoded form post entries using the
class
.
Example:
NameValuePairs
See Also:
-
Constructor Summary
ModifierConstructorDescriptionSerializedPart
(String name, Object value, HttpPartType type, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean skipIfEmpty) Constructor.protected
SerializedPart
(SerializedPart copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionasHeader()
Convert the object to aHeader
.copy()
Creates a copy of this object.copyWith
(HttpPartSerializerSession serializer, HttpPartSchema schema) Copies this bean and sets the serializer and schema on it.getValue()
static SerializedPart
Instantiates a new instance of this object.static SerializedPart
Instantiates a new instance of this object.schema
(HttpPartSchema value) Sets the schema object that defines the format of the output.serializer
(HttpPartSerializer value) Sets the serializer to use for serializing the value to a string value.Sets the serializer to use for serializing the value to a string value.Don't serialize this pair if the value isnull or an empty string.skipIfEmpty
(boolean value) Don't serialize this pair if the value isnull or an empty string.type
(HttpPartType value) Sets the HTTP part type.Methods inherited from class org.apache.juneau.http.part.BasicPart
assertName, assertValue, canCast, cast, getName, getRawValue, ofPair, toString
-
Constructor Details
-
SerializedPart
public SerializedPart(String name, Object value, HttpPartType type, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean skipIfEmpty) Constructor.- Parameters:
name
- The part name.value
- The POJO to serialize to The part value.type
- 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.
Ifnull , defaults to the schema defined on the serializer.
If that's alsonull , defaults toHttpPartSchema.DEFAULT
.
Only used if serializer is schema-aware (e.g.OpenApiSerializer
).skipIfEmpty
- If value is a blank string, the value should return asnull .
-
SerializedPart
Copy constructor.- Parameters:
copyFrom
- The object to copy.
-
-
Method Details
-
of
Instantiates a new instance of this object.- Parameters:
name
- The part name.value
- The part value.
Can be any POJO.- Returns:
- A new
SerializedPart
object, nevernull .
-
of
Instantiates a new instance of this object.- Parameters:
name
- The part name.value
- The part value supplier.
Can be a supplier of any POJO.- Returns:
- A new
SerializedPart
object, nevernull .
-
copy
Creates a copy of this object.- Returns:
- A new copy of this object.
-
type
Sets the HTTP part type.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
serializer
Sets the serializer to use for serializing the value to a string value.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
serializer
Sets the serializer to use for serializing the value to a string value.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
schema
Sets the schema object that defines the format of the output.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
copyWith
Copies this bean and sets the serializer and schema on it.- Parameters:
serializer
- The new serializer for the bean. Can benull .schema
- The new schema for the bean. Can benull .- Returns:
- Either a new bean with the serializer set, or this bean if
both values are
null or the serializer and schema were already set.
-
skipIfEmpty
Don't serialize this pair if the value isnull or an empty string.- Returns:
- This object.
-
skipIfEmpty
Don't serialize this pair if the value isnull or an empty string.- Parameters:
value
- The new value of this setting.- Returns:
- This object.
-
asHeader
Description copied from interface:Headerable
Convert the object to aHeader
.- Specified by:
asHeader
in interfaceHeaderable
- Overrides:
asHeader
in classBasicPart
- Returns:
- The object converted to a
Header
.
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicPart
-