Class AvroSchema
java.lang.Object
io.confluent.kafka.schemaregistry.avro.AvroSchema
- All Implemented Interfaces:
ParsedSchema
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface io.confluent.kafka.schemaregistry.ParsedSchema
RESERVED -
Constructor Summary
ConstructorsConstructorDescriptionAvroSchema(String schemaString) AvroSchema(String schemaString, List<SchemaReference> references, Map<String, String> resolvedReferences, Metadata metadata, RuleSet ruleSet, Integer version, boolean isNew) AvroSchema(String schemaString, List<SchemaReference> references, Map<String, String> resolvedReferences, Integer version) AvroSchema(String schemaString, List<SchemaReference> references, Map<String, String> resolvedReferences, Integer version, boolean isNew) AvroSchema(org.apache.avro.Schema schemaObj) AvroSchema(org.apache.avro.Schema schemaObj, Integer version) -
Method Summary
Modifier and TypeMethodDescriptionReturns a canonical string representation of the schema.copy()Returns a copy of this schema.Returns a copy of this schema, but with the given metadata and rule set.Returns a copy of this schema, but with the given version.copy(Map<SchemaEntity, Set<String>> tagsToAdd, Map<SchemaEntity, Set<String>> tagsToRemove) Returns a copy of this schema, but with the given tags.copyMessage(Object message) booleanbooleanequivalent(ParsedSchema schema) Returns whether the underlying raw representations are equivalent, ignoring version and references.formattedString(String format) Returns a formatted string according to a type-specific format.fromJson(com.fasterxml.jackson.databind.JsonNode json) protected org.apache.avro.Schema.ParserinthashCode()booleanhasTopLevelField(String field) Returns the inline tagged entities of the schema.Returns the set of inline tags embedded in the schema.isBackwardCompatible(ParsedSchema previousSchema) Checks the backward compatibility between this schema and the specified schema.booleanisNew()metadata()Returns metadata.name()Returns a name for the schema.Returns a normalized copy of this schema.org.apache.avro.SchemaReturns the underlying raw representation of the schema.Returns a list of schema references.ruleSet()Returns a rule set.Returns the schema type.com.fasterxml.jackson.databind.JsonNodetoString()transformMessage(RuleContext ctx, FieldTransform transform, Object message) version()Returns the version of the schema if set.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.confluent.kafka.schemaregistry.ParsedSchema
canLookup, deepEquals, getReservedFields, isBackwardCompatible, isCompatible, isCompatible, tags, validate, validate
-
Field Details
-
TYPE
- See Also:
-
TAGS
- See Also:
-
NAME_FIELD
- See Also:
-
FIELDS_FIELD
- See Also:
-
-
Constructor Details
-
AvroSchema
-
AvroSchema
-
AvroSchema
-
AvroSchema
-
AvroSchema
public AvroSchema(org.apache.avro.Schema schemaObj) -
AvroSchema
-
-
Method Details
-
copy
Description copied from interface:ParsedSchemaReturns a copy of this schema.- Specified by:
copyin interfaceParsedSchema- Returns:
- a copy of this schema
-
copy
Description copied from interface:ParsedSchemaReturns a copy of this schema, but with the given version.- Specified by:
copyin interfaceParsedSchema- Parameters:
version- the version- Returns:
- a copy of this schema, but with the given version
-
copy
Description copied from interface:ParsedSchemaReturns a copy of this schema, but with the given metadata and rule set.- Specified by:
copyin interfaceParsedSchema- Parameters:
metadata- the metadataruleSet- the rule set- Returns:
- a copy of this schema, but with the given metadata and rule set
-
copy
public ParsedSchema copy(Map<SchemaEntity, Set<String>> tagsToAdd, Map<SchemaEntity, Set<String>> tagsToRemove) Description copied from interface:ParsedSchemaReturns a copy of this schema, but with the given tags.- Specified by:
copyin interfaceParsedSchema- Parameters:
tagsToAdd- map of tags to add to the schema record or field, where the key is the entity and the value is the set of tags. If the tag already exists, do nothing.tagsToRemove- map of tags to remove from the schema record or field, where the key is the entity and the value is the set of tags. If the tag does not exist, do nothing.- Returns:
- a copy of this schema, but with the given tags
-
getParser
protected org.apache.avro.Schema.Parser getParser() -
rawSchema
public org.apache.avro.Schema rawSchema()Description copied from interface:ParsedSchemaReturns the underlying raw representation of the schema.- Specified by:
rawSchemain interfaceParsedSchema- Returns:
- the raw schema
-
hasTopLevelField
- Specified by:
hasTopLevelFieldin interfaceParsedSchema- Parameters:
field- name of the field to check- Returns:
- true, if the schema has field in its top level fields. false, otherwise.
-
schemaType
Description copied from interface:ParsedSchemaReturns the schema type.- Specified by:
schemaTypein interfaceParsedSchema- Returns:
- the schema type
-
name
Description copied from interface:ParsedSchemaReturns a name for the schema.- Specified by:
namein interfaceParsedSchema- Returns:
- the name, or null
-
canonicalString
Description copied from interface:ParsedSchemaReturns a canonical string representation of the schema.- Specified by:
canonicalStringin interfaceParsedSchema- Returns:
- the canonical representation
-
formattedString
Description copied from interface:ParsedSchemaReturns a formatted string according to a type-specific format.- Specified by:
formattedStringin interfaceParsedSchema- Returns:
- the formatted string
-
version
Description copied from interface:ParsedSchemaReturns the version of the schema if set.- Specified by:
versionin interfaceParsedSchema- Returns:
- the version
-
references
Description copied from interface:ParsedSchemaReturns a list of schema references.- Specified by:
referencesin interfaceParsedSchema- Returns:
- the schema references
-
resolvedReferences
-
metadata
Description copied from interface:ParsedSchemaReturns metadata.- Specified by:
metadatain interfaceParsedSchema- Returns:
- the metadata
-
ruleSet
Description copied from interface:ParsedSchemaReturns a rule set.- Specified by:
ruleSetin interfaceParsedSchema- Returns:
- the rule set
-
isNew
public boolean isNew() -
normalize
Description copied from interface:ParsedSchemaReturns a normalized copy of this schema. Normalization generally ignores ordering when it is not significant.- Specified by:
normalizein interfaceParsedSchema- Returns:
- the normalized representation
-
isBackwardCompatible
Description copied from interface:ParsedSchemaChecks the backward compatibility between this schema and the specified schema.Custom providers may choose to modify this schema during this check, to ensure that it is compatible with the specified schema.
- Specified by:
isBackwardCompatiblein interfaceParsedSchema- Parameters:
previousSchema- previous schema- Returns:
- an empty list if this schema is backward compatible with the previous schema, otherwise the list of error messages
-
equivalent
Returns whether the underlying raw representations are equivalent, ignoring version and references.- Specified by:
equivalentin interfaceParsedSchema- Returns:
- whether the underlying raw representations are equivalent
-
equals
-
hashCode
public int hashCode() -
toString
-
fromJson
- Specified by:
fromJsonin interfaceParsedSchema- Throws:
IOException
-
toJson
- Specified by:
toJsonin interfaceParsedSchema- Throws:
IOException
-
copyMessage
- Specified by:
copyMessagein interfaceParsedSchema
-
transformMessage
public Object transformMessage(RuleContext ctx, FieldTransform transform, Object message) throws RuleException - Specified by:
transformMessagein interfaceParsedSchema- Throws:
RuleException
-
inlineTags
Description copied from interface:ParsedSchemaReturns the set of inline tags embedded in the schema.- Specified by:
inlineTagsin interfaceParsedSchema- Returns:
- the tags
-
inlineTaggedEntities
Description copied from interface:ParsedSchemaReturns the inline tagged entities of the schema.- Specified by:
inlineTaggedEntitiesin interfaceParsedSchema- Returns:
- a map of entity name to tags
-