Interface DescriptorSerializer<B extends Descriptor>
- Type Parameters:
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.
- All Superinterfaces:
Guarded
,Serializable
- All Known Subinterfaces:
BvGenerator
,CfpGenerator
,DescriptorGenerator<B>
,EcfpGenerator
,FvGenerator
,MaccsGenerator
,PfGenerator
- All Known Implementing Classes:
AbstractShapeGenerator
IO preserves the data represented by the descriptors bare form. The additional details possibly represented by the
rich form are not preserved during serialization; so deserialization is possible only into the bare
form. Note that it is possible for a 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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.chemaxon.descriptors.common.Guarded
Guarded.EnsureThat, Guarded.New
-
Method Summary
Modifier and TypeMethodDescriptionfromByteArray
(byte[] desc) Builds a descriptor from its byte array representation.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.Creates the String representation of a descriptor object.Methods inherited from interface com.chemaxon.descriptors.common.Guarded
getGuardObject
-
Method Details
-
toByteArray
Creates the byte array representation of a descriptor object.Note that implementations of this method must ensure the matching of associated guard objects.
The descriptors bare form can be reconstructed using
fromByteArray(byte[])
.- Parameters:
desc
- Descriptor (only bare form is considered)- Returns:
- Byte array representation of the descriptor
-
toString
Creates the String representation of a descriptor object.The descriptors bare form can be reconstructed using
fromString(java.lang.String)
.- Parameters:
desc
- Descriptor (only bare form is considered)- Returns:
- String representation of descriptor
-
fromString
Builds a descriptor from its string representation.Please note that the compatibility of this (the reconstructing)
DescriptorGenerator
, regarding to the serializing generator (on whichtoString(com.chemaxon.descriptors.common.Descriptor)
was called to construct the String form) is not checked; compatibility must be ensured by the user application.- Parameters:
desc
- String representation- Returns:
- Reconstructed descriptors bare form
-
fromByteArray
Builds a descriptor from its byte array representation.Please note that the compatibility of this (the reconstructing)
DescriptorGenerator
, regarding to the serializing generator (on whichtoByteArray(com.chemaxon.descriptors.common.Descriptor)
was called to construct the byte array form) is not checked; compatibility must be ensured by the user application.- Parameters:
desc
- Byte array of the descriptor- Returns:
- Reconstructed descriptors bare form
-
serializerIsEqualWith
Check strict equivalence of serializers.Implementations are expected to be symmetric and transitive.
- Parameters:
other
- Other serializer- Returns:
true
when and only when the two serializers (this
andother
) are the same thus interchangeable. Implementations typically check class equivalence, guard object match and parameter match.
-