public class NestedBaggageContextProvider extends java.lang.Object implements BaggageProvider<NestedBaggageContext>
BaggageProvider for NestedBaggageContext, which extends AtomContext to interpret atoms as
nested data structures.
| Constructor and Description |
|---|
NestedBaggageContextProvider() |
| Modifier and Type | Method and Description |
|---|---|
NestedBaggageContext |
branch(NestedBaggageContext from)
Create and return a copy of
from. |
NestedBaggageContext |
deserialize(byte[] serialized,
int offset,
int length)
Deserialize the provided serialized baggage representation.
|
NestedBaggageContext |
deserialize(java.nio.ByteBuffer buf)
Deserialize the provided serialized baggage representation.
|
void |
discard(NestedBaggageContext baggage)
Discards
baggage. |
boolean |
isValid(BaggageContext baggage) |
NestedBaggageContext |
join(NestedBaggageContext left,
NestedBaggageContext right)
Merge the contents of
left and right and return as baggage. |
NestedBaggageContext |
newInstance() |
byte[] |
serialize(NestedBaggageContext baggage)
Serialize the provided baggage instance to its byte representation.
|
byte[] |
serialize(NestedBaggageContext baggage,
int maximumSerializedSize)
Serialize the provided baggage instance to its byte representation and trim the baggage so that its serialized
size is
<= maximumSerializedSize. |
public boolean isValid(BaggageContext baggage)
isValid in interface BaggageProvider<NestedBaggageContext>baggage - a BaggageContext to testbaggage is an instance of B or if baggage is null.public NestedBaggageContext newInstance()
newInstance in interface BaggageProvider<NestedBaggageContext>B, which may be null to indicate an empty baggagepublic void discard(NestedBaggageContext baggage)
BaggageProviderbaggage. If this TransitLayer performs anything like reference counting, then this method
is where decrementing reference counts would happen.discard in interface BaggageProvider<NestedBaggageContext>baggage - a baggage instancepublic NestedBaggageContext branch(NestedBaggageContext from)
BaggageProviderfrom. If this TransitLayer performs anything like reference counting,
then this method might just return from while incrementing reference counts.
This method might create a new instance of B and might even modify the contents of frombranch in interface BaggageProvider<NestedBaggageContext>from - a baggage instance, possibly nullfrom, possibly nullpublic NestedBaggageContext join(NestedBaggageContext left, NestedBaggageContext right)
BaggageProviderleft and right and return as baggage. left and
right should be treated as discarded (or reused) after this method call.join in interface BaggageProvider<NestedBaggageContext>left - a baggage instance, possibly nullright - a baggage instance, possibly nullleft and rightpublic NestedBaggageContext deserialize(byte[] serialized, int offset, int length)
BaggageProviderdeserialize in interface BaggageProvider<NestedBaggageContext>serialized - a serialized baggageoffset - offset into the array where the baggage bytes beginlength - lenft of the baggage bytespublic NestedBaggageContext deserialize(java.nio.ByteBuffer buf)
BaggageProviderdeserialize in interface BaggageProvider<NestedBaggageContext>buf - a serialized baggagepublic byte[] serialize(NestedBaggageContext baggage)
BaggageProvider#branch(Baggage) is also being called prior to serialization.serialize in interface BaggageProvider<NestedBaggageContext>baggage - a baggage instance to serialize, possibly nullbaggage, which might be null or an empty byte arraypublic byte[] serialize(NestedBaggageContext baggage, int maximumSerializedSize)
BaggageProvider<= maximumSerializedSize. This method should behave as though #branch(Baggage) is also
being called prior to serialization.serialize in interface BaggageProvider<NestedBaggageContext>baggage - a baggage instance to serialize, possibly nullmaximumSerializedSize - the maximum size in bytes of the serialized baggage.baggage, which might be null or an empty byte array