public class AvroSchema extends Object implements ParsedSchema
| Modifier and Type | Class and Description |
|---|---|
static class |
AvroSchema.Format |
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELDS_FIELD |
static String |
NAME_FIELD |
static String |
TAGS |
static String |
TYPE |
RESERVED| Constructor and Description |
|---|
AvroSchema(org.apache.avro.Schema schemaObj) |
AvroSchema(org.apache.avro.Schema schemaObj,
Integer version) |
AvroSchema(String schemaString) |
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(String schemaString,
List<SchemaReference> references,
Map<String,String> resolvedReferences,
Metadata metadata,
RuleSet ruleSet,
Integer version,
boolean isNew) |
| Modifier and Type | Method and Description |
|---|---|
String |
canonicalString()
Returns a canonical string representation of the schema.
|
AvroSchema |
copy()
Returns a copy of this schema.
|
AvroSchema |
copy(Integer version)
Returns a copy of this schema, but with the given version.
|
ParsedSchema |
copy(Map<SchemaEntity,Set<String>> tagsToAdd,
Map<SchemaEntity,Set<String>> tagsToRemove)
Returns a copy of this schema, but with the given tags.
|
AvroSchema |
copy(Metadata metadata,
RuleSet ruleSet)
Returns a copy of this schema, but with the given metadata and rule set.
|
Object |
copyMessage(Object message) |
boolean |
equals(Object o) |
boolean |
equivalent(ParsedSchema schema)
Returns whether the underlying raw representations are equivalent,
ignoring version and references.
|
String |
formattedString(String format)
Returns a formatted string according to a type-specific format.
|
Object |
fromJson(com.fasterxml.jackson.databind.JsonNode json) |
protected org.apache.avro.Schema.Parser |
getParser() |
int |
hashCode() |
boolean |
hasTopLevelField(String field) |
Map<SchemaEntity,Set<String>> |
inlineTaggedEntities()
Returns the inline tagged entities of the schema.
|
Set<String> |
inlineTags()
Returns the set of inline tags embedded in the schema.
|
List<String> |
isBackwardCompatible(ParsedSchema previousSchema)
Checks the backward compatibility between this schema and the specified schema.
|
boolean |
isNew() |
Metadata |
metadata()
Returns metadata.
|
String |
name()
Returns a name for the schema.
|
AvroSchema |
normalize()
Returns a normalized copy of this schema.
|
org.apache.avro.Schema |
rawSchema()
Returns the underlying raw representation of the schema.
|
List<SchemaReference> |
references()
Returns a list of schema references.
|
Map<String,String> |
resolvedReferences() |
RuleSet |
ruleSet()
Returns a rule set.
|
String |
schemaType()
Returns the schema type.
|
com.fasterxml.jackson.databind.JsonNode |
toJson(Object message) |
String |
toString() |
Object |
transformMessage(RuleContext ctx,
FieldTransform transform,
Object message) |
Integer |
version()
Returns the version of the schema if set.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcanLookup, deepEquals, getReservedFields, isCompatible, tags, validate, validatepublic static final String TYPE
public static final String TAGS
public static final String NAME_FIELD
public static final String FIELDS_FIELD
public AvroSchema(String schemaString)
public AvroSchema(String schemaString, List<SchemaReference> references, Map<String,String> resolvedReferences, Integer version)
public AvroSchema(String schemaString, List<SchemaReference> references, Map<String,String> resolvedReferences, Integer version, boolean isNew)
public AvroSchema(String schemaString, List<SchemaReference> references, Map<String,String> resolvedReferences, Metadata metadata, RuleSet ruleSet, Integer version, boolean isNew)
public AvroSchema(org.apache.avro.Schema schemaObj)
public AvroSchema(org.apache.avro.Schema schemaObj,
Integer version)
public AvroSchema copy()
ParsedSchemacopy in interface ParsedSchemapublic AvroSchema copy(Integer version)
ParsedSchemacopy in interface ParsedSchemaversion - the versionpublic AvroSchema copy(Metadata metadata, RuleSet ruleSet)
ParsedSchemacopy in interface ParsedSchemametadata - the metadataruleSet - the rule setpublic ParsedSchema copy(Map<SchemaEntity,Set<String>> tagsToAdd, Map<SchemaEntity,Set<String>> tagsToRemove)
ParsedSchemacopy in interface ParsedSchematagsToAdd - 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.protected org.apache.avro.Schema.Parser getParser()
public org.apache.avro.Schema rawSchema()
ParsedSchemarawSchema in interface ParsedSchemapublic boolean hasTopLevelField(String field)
hasTopLevelField in interface ParsedSchemafield - name of the field to checkpublic String schemaType()
ParsedSchemaschemaType in interface ParsedSchemapublic String name()
ParsedSchemaname in interface ParsedSchemapublic String canonicalString()
ParsedSchemacanonicalString in interface ParsedSchemapublic String formattedString(String format)
ParsedSchemaformattedString in interface ParsedSchemapublic Integer version()
ParsedSchemaversion in interface ParsedSchemapublic List<SchemaReference> references()
ParsedSchemareferences in interface ParsedSchemapublic Metadata metadata()
ParsedSchemametadata in interface ParsedSchemapublic RuleSet ruleSet()
ParsedSchemaruleSet in interface ParsedSchemapublic boolean isNew()
public AvroSchema normalize()
ParsedSchemanormalize in interface ParsedSchemapublic List<String> isBackwardCompatible(ParsedSchema previousSchema)
ParsedSchemaCustom providers may choose to modify this schema during this check, to ensure that it is compatible with the specified schema.
isBackwardCompatible in interface ParsedSchemapreviousSchema - previous schemapublic boolean equivalent(ParsedSchema schema)
equivalent in interface ParsedSchemapublic Object fromJson(com.fasterxml.jackson.databind.JsonNode json) throws IOException
fromJson in interface ParsedSchemaIOExceptionpublic com.fasterxml.jackson.databind.JsonNode toJson(Object message) throws IOException
toJson in interface ParsedSchemaIOExceptionpublic Object copyMessage(Object message)
copyMessage in interface ParsedSchemapublic Object transformMessage(RuleContext ctx, FieldTransform transform, Object message) throws RuleException
transformMessage in interface ParsedSchemaRuleExceptionpublic Set<String> inlineTags()
ParsedSchemainlineTags in interface ParsedSchemapublic Map<SchemaEntity,Set<String>> inlineTaggedEntities()
ParsedSchemainlineTaggedEntities in interface ParsedSchemaCopyright © 2025 Confluent, Inc.. All rights reserved.