Package deltix.qsrv.hf.pub.codec
Class SchemaComparator
- java.lang.Object
-
- deltix.qsrv.hf.pub.codec.SchemaComparator
-
public abstract class SchemaComparator extends java.lang.Object
Utilities for comparing two record descriptors in order to determine whether messages serialized with one can be deserialized with another.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SchemaComparator.Listener
-
Field Summary
Fields Modifier and Type Field Description static long
DETECT_ALL_CHANGES
Detect all changes that affect non-static fields, except annotations such as titles or primary keys (ignore nothing).static long
DETECT_ONLY_STRUCTURAL_INCOMPATIBILITY
Detect only those changes that cause structural incompatibility between two schemas, ignoring name changes, and anything else unless it is guaranteed to make the schemas incompatible.static SchemaComparator.Listener
DUMMY_LISTENER
static long
IGNORE_BINDING_CHANGE
Ignore changed bound class names.static long
IGNORE_CLASS_NAME_CHANGE
Ignore changed class names, as long as their internal structure remains compatible.static long
IGNORE_ENUM_EXTENSION
Ignore the extention of enumerated types.static long
IGNORE_ENUM_NAME_CHANGE
Ignore changed enum constant names.static long
IGNORE_ENUM_REDUCTION
Ignore the reduction of enumerated types.static long
IGNORE_FIELD_NAME_CHANGE
Ignore changed field names, as long as their types and encodings remain compatible.static long
IGNORE_HIERARCHY_CHANGE
Ignore changes in class hierarchy, as long as all fields are in the same order.static long
IGNORE_RANGE_NARROWING
Ignore the narrowing of numeric value ranges.
-
Constructor Summary
Constructors Constructor Description SchemaComparator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
schemaChanged(long options, RecordClassDescriptor old, RecordClassDescriptor nw)
static boolean
schemaChanged(long options, RecordClassDescriptor old, RecordClassDescriptor nw, SchemaComparator.Listener listener)
Compare two record descriptors in order to determine whether messages serialized with one can be deserialized with another.static boolean
schemaChanged(RecordClassDescriptor old, RecordClassDescriptor nw, SchemaComparator.Listener listener)
Same asschemaChanged(long, deltix.qsrv.hf.pub.md.RecordClassDescriptor, deltix.qsrv.hf.pub.md.RecordClassDescriptor, deltix.qsrv.hf.pub.codec.SchemaComparator.Listener)
invoked with all ignore options, i.e. it will return true only if the schema change is guaranteed
-
-
-
Field Detail
-
DETECT_ONLY_STRUCTURAL_INCOMPATIBILITY
public static final long DETECT_ONLY_STRUCTURAL_INCOMPATIBILITY
Detect only those changes that cause structural incompatibility between two schemas, ignoring name changes, and anything else unless it is guaranteed to make the schemas incompatible.- See Also:
- Constant Field Values
-
DETECT_ALL_CHANGES
public static final long DETECT_ALL_CHANGES
Detect all changes that affect non-static fields, except annotations such as titles or primary keys (ignore nothing).- See Also:
- Constant Field Values
-
IGNORE_FIELD_NAME_CHANGE
public static final long IGNORE_FIELD_NAME_CHANGE
Ignore changed field names, as long as their types and encodings remain compatible.- See Also:
- Constant Field Values
-
IGNORE_CLASS_NAME_CHANGE
public static final long IGNORE_CLASS_NAME_CHANGE
Ignore changed class names, as long as their internal structure remains compatible.- See Also:
- Constant Field Values
-
IGNORE_ENUM_NAME_CHANGE
public static final long IGNORE_ENUM_NAME_CHANGE
Ignore changed enum constant names.- See Also:
- Constant Field Values
-
IGNORE_ENUM_EXTENSION
public static final long IGNORE_ENUM_EXTENSION
Ignore the extention of enumerated types.- See Also:
- Constant Field Values
-
IGNORE_ENUM_REDUCTION
public static final long IGNORE_ENUM_REDUCTION
Ignore the reduction of enumerated types.- See Also:
- Constant Field Values
-
IGNORE_RANGE_NARROWING
public static final long IGNORE_RANGE_NARROWING
Ignore the narrowing of numeric value ranges.- See Also:
- Constant Field Values
-
IGNORE_BINDING_CHANGE
public static final long IGNORE_BINDING_CHANGE
Ignore changed bound class names.- See Also:
- Constant Field Values
-
IGNORE_HIERARCHY_CHANGE
public static final long IGNORE_HIERARCHY_CHANGE
Ignore changes in class hierarchy, as long as all fields are in the same order.- See Also:
- Constant Field Values
-
DUMMY_LISTENER
public static final SchemaComparator.Listener DUMMY_LISTENER
-
-
Method Detail
-
schemaChanged
public static boolean schemaChanged(long options, RecordClassDescriptor old, RecordClassDescriptor nw, SchemaComparator.Listener listener)
Compare two record descriptors in order to determine whether messages serialized with one can be deserialized with another. Most changes make serialized data at least potentially incompatible. Exceptions include changed field titles or extended value ranges. Some changes make data completely incompatible, such as changed sequence of data types, or incompatible encoding changes. This utility always ignores static fields, because it is concerned with serialized data only. Also, this utility ignores the "primary key" attribute for the same reasons.- Parameters:
options
- A bitwise combination of IGNORE_ options.old
- Old record descriptor (presumably describing some data that is already serialized).nw
- New look of the same record descriptor, considered for potential deserialization of the same data.listener
- Gets notified about discrepancies. Can be null.- Returns:
- Whether any relevant changes have been observed, except those ignored according to the specified flags.
-
schemaChanged
public static boolean schemaChanged(long options, RecordClassDescriptor old, RecordClassDescriptor nw)
-
schemaChanged
public static boolean schemaChanged(RecordClassDescriptor old, RecordClassDescriptor nw, SchemaComparator.Listener listener)
Same asschemaChanged(long, deltix.qsrv.hf.pub.md.RecordClassDescriptor, deltix.qsrv.hf.pub.md.RecordClassDescriptor, deltix.qsrv.hf.pub.codec.SchemaComparator.Listener)
invoked with all ignore options, i.e. it will return true only if the schema change is guaranteed
-
-