Package com.linkedin.venice.schema
Class SchemaEntry
- java.lang.Object
-
- com.linkedin.venice.schema.SchemaEntry
-
- Direct Known Subclasses:
GeneratedSchemaEntry
public class SchemaEntry extends java.lang.Object
SchemaEntry
is composed of a schema and its corresponding id. Internally, this class will maintain a parsedSchema
-
-
Field Summary
Fields Modifier and Type Field Description static DirectionalSchemaCompatibilityType
DEFAULT_SCHEMA_CREATION_COMPATIBILITY_TYPE
-
Constructor Summary
Constructors Constructor Description SchemaEntry(int id, byte[] bytes)
SchemaEntry(int id, java.lang.String schemaStr)
Primary constructor taking a literal id and schema.SchemaEntry(int id, org.apache.avro.Schema schema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SchemaEntry
clone()
boolean
equals(java.lang.Object obj)
java.lang.String
getCanonicalSchemaStr()
int
getId()
org.apache.avro.Schema
getSchema()
byte[]
getSchemaBytes()
java.lang.String
getSchemaStr()
int
hashCode()
boolean
isNewSchemaCompatible(SchemaEntry newSchemaEntry, DirectionalSchemaCompatibilityType expectedCompatibilityType)
This function will check whether a new schema is compatible with this one according to the passed in {@param expectedCompatibilityType}.java.lang.String
toString()
java.lang.String
toString(boolean pretty)
-
-
-
Field Detail
-
DEFAULT_SCHEMA_CREATION_COMPATIBILITY_TYPE
public static final DirectionalSchemaCompatibilityType DEFAULT_SCHEMA_CREATION_COMPATIBILITY_TYPE
-
-
Method Detail
-
getSchemaStr
public java.lang.String getSchemaStr()
-
getCanonicalSchemaStr
public java.lang.String getCanonicalSchemaStr()
-
getId
public int getId()
- Returns:
- the id
-
getSchema
public org.apache.avro.Schema getSchema()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
clone
public SchemaEntry clone()
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(boolean pretty)
-
getSchemaBytes
public byte[] getSchemaBytes()
-
isNewSchemaCompatible
public boolean isNewSchemaCompatible(SchemaEntry newSchemaEntry, DirectionalSchemaCompatibilityType expectedCompatibilityType)
This function will check whether a new schema is compatible with this one according to the passed in {@param expectedCompatibilityType}. Right now, this function is using the util function provided by avro-1.7+ to check compatibility. We need to remove the util class manually copied when venice is able to use avro-1.7+- Returns:
- true if compatible, false otherwise
-
-