B
- Represented bare descriptor type. Note that rich descriptor type is not referenced in this level. Rich
descriptor type is only introduced by the implementations.@Beta @PublicAPI public interface DescriptorSerializer<B extends Descriptor> extends Serializable, Guarded
DescriptorGenerator
to not distinguish between rich and bare
descriptors.
Note that object serialization must preserve guard objects returned by Guarded.getGuardObject()
.
Note that serialization does not preserve the guard object reference. It is an external API contract to ensure that deserialization is fed only data from a compatible representation.
Please note that this interface is marked with Beta
annotation, so it can be subject of incompatible changes
or removal in later releases.
Guarded.EnsureThat, Guarded.New
Modifier and Type | Method and Description |
---|---|
B |
fromByteArray(byte[] desc)
Builds a descriptor from its byte array representation.
|
B |
fromString(String desc)
Builds a descriptor from its string representation.
|
boolean |
serializerIsEqualWith(DescriptorSerializer other)
Check strict equivalence of serializers.
|
byte[] |
toByteArray(B desc)
Creates the byte array representation of a descriptor object.
|
String |
toString(B desc)
Creates the String representation of a descriptor object.
|
getGuardObject
byte[] toByteArray(B desc)
The descriptors bare form can be reconstructed using fromByteArray(byte[])
.
desc
- Descriptor (only bare form is considered)String toString(B desc)
The descriptors bare form can be reconstructed using fromString(java.lang.String)
.
desc
- Descriptor (only bare form is considered)B fromString(String desc)
Please note that the compatibility of this (the reconstructing) DescriptorGenerator
, regarding to the
serializing generator (on which toString(com.chemaxon.descriptors.common.Descriptor)
was called to construct the String form) is not checked; compatibility must be ensured by the user application.
desc
- String representationB fromByteArray(byte[] desc)
Please note that the compatibility of this (the reconstructing) DescriptorGenerator
, regarding to the
serializing generator (on which
toByteArray(com.chemaxon.descriptors.common.Descriptor)
was called to construct the
byte array form) is not checked; compatibility must be ensured by the user application.
desc
- Byte array of the descriptorboolean serializerIsEqualWith(DescriptorSerializer other)
other
- Other serializertrue
when and only when the two serializers (this
and other
) are the same thus
interchangeable. Implementations typically check class equivalence, guard object match and parameter match.