Class LogicalTypesSchemaVisitor
- All Implemented Interfaces:
LogicalTypesVisitor<Object>,org.antlr.v4.runtime.tree.ParseTreeVisitor<Object>
LogicalType.
Visitor outputs (consumed by toLogicalType()):
namespace— from anyNAMESPACEstatement.namedTypes— from eachSTRUCT <name> (...)orENUM <name> (...)statement (locals).externalImports— from eachUSING TYPE x FOR 'uri'statement; maps the typeName to the wire-format URI.rootSchema— from the trailingTYPE <typeExpr>statement (or sugar-inferred when absent).
externalTypes is inferred by toLogicalType():
any NAMED_TYPE_REF FQN reachable from the root or from a local body
that isn't declared locally is treated as external. There is no syntactic
marker; bare names always inherit the active NAMESPACE, matching
Avro's rule.
What the visitor does NOT produce: the references list.
The DDL grammar has no syntax for SR-side coordinates (subject + version)
because those are deployment metadata that vary across environments and
shouldn't be embedded in schema source. So the produced LT has an empty
references list. The caller is responsible for attaching
references (and the corresponding resolvedReferences
content) before SR registration. USING TYPE populates schema-text shape
(which $ref/import string to emit); it does not bridge to SR
resolution.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionURI bindings forUSING TYPE x FOR '<uri>';declarations.Convenience: bundles all visitor outputs into aLogicalType, including the namespace from anyNAMESPACEstatement.Visit a parse tree produced byLogicalTypesParser.aliasStmt().Visit a parse tree produced byLogicalTypesParser.createTypeStmt().Visit a parse tree produced byLogicalTypesParser.declareNamespaceStmt().Visit a parse tree produced byLogicalTypesParser.mapType().Visit a parse tree produced by theMapTypeExprlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced by thePostfixArraylabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced by thePostfixMultisetlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced by thePrefixArraylabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced by thePrefixMultisetlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced byLogicalTypesParser.primitiveType().Visit a parse tree produced by thePrimitiveTypeExprlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced by theQualifiedNameExprlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced byLogicalTypesParser.registerTypeStmt().Visit a parse tree produced byLogicalTypesParser.rowType().Visit a parse tree produced by theRowTypeExprlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced byLogicalTypesParser.script().Visit a parse tree produced byLogicalTypesParser.unionType().Visit a parse tree produced by theUnionTypeExprlabeled alternative inLogicalTypesParser.typeExpr().Visit a parse tree produced by theVariantTypeExprlabeled alternative inLogicalTypesParser.typeExpr().Methods inherited from class io.confluent.kafka.schemaregistry.type.logical.generated.LogicalTypesBaseVisitor
visitBoolLiteral, visitBytesLiteral, visitCase_expr, visitCastType, visitCheck_expr, visitCheck_expr_add, visitCheck_expr_and, visitCheck_expr_between, visitCheck_expr_compare, visitCheck_expr_in, visitCheck_expr_isnull, visitCheck_expr_like, visitCheck_expr_list, visitCheck_expr_mul, visitCheck_expr_or, visitCheck_expr_unary_sign, visitCheckCase, visitCheckClause, visitCheckColumnRef, visitCheckExprNot, visitCheckExprNotPass, visitCheckFunc, visitCheckLiteral, visitCheckParen, visitColid, visitColumnConstraint, visitColumnref, visitCommentClause, visitDecimalLiteral, visitDefaultClause, visitDoubleLiteral, visitEnumBody, visitEnumValue, visitEscape_clause, visitFieldDef, visitFieldName, visitFunc_application, visitFunc_expr, visitFuncCast, visitFuncCurrentTimestamp, visitFuncExtract, visitFuncPosition, visitFuncSubstringCommas, visitFuncSubstringFromFor, visitFuncTrim, visitFuncTryVariantGet, visitFuncVariantGet, visitIdentifier, visitIndirection, visitIndirection_el, visitInTargetExpr, visitInTargetParenList, visitIntLiteral, visitLiteral, visitMessageClause, visitNonReservedKeyword, visitNullability, visitQualifiedName, visitStringLiteral, visitStructBody, visitStructBodyItem, visitTableConstraint, visitTagsClause, visitUnionBranch, visitVariantType, visitWhen_clause, visitWithClause, visitWithPropertyMethods inherited from class org.antlr.v4.runtime.tree.AbstractParseTreeVisitor
aggregateResult, defaultResult, shouldVisitNextChild, visit, visitChildren, visitErrorNode, visitTerminalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.antlr.v4.runtime.tree.ParseTreeVisitor
visit, visitChildren, visitErrorNode, visitTerminal
-
Constructor Details
-
LogicalTypesSchemaVisitor
public LogicalTypesSchemaVisitor()
-
-
Method Details
-
getNamespace
-
getExternalImports
URI bindings forUSING TYPE x FOR '<uri>';declarations. BecomesLogicalType.getExternalImports()ontoLogicalType(). -
getNamedTypes
-
getRootSchema
-
toLogicalType
Convenience: bundles all visitor outputs into aLogicalType, including the namespace from anyNAMESPACEstatement.LogicalType.getExternalTypes()is inferred: everyNAMED_TYPE_REFFQN reachable from the root or any local body that isn't itself a local declaration is treated as external. Downstream enrichment is responsible for SR-fetching and promoting bodies intonamedTypes.USING TYPE validation (no shadowing, no dangling entries) runs during parsing inside
visitScript(io.confluent.kafka.schemaregistry.type.logical.generated.LogicalTypesParser.ScriptContext), so aLogicalTypeproduced here is guaranteed to satisfy both invariants. -
visitScript
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.script().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitScriptin interfaceLogicalTypesVisitor<Object>- Overrides:
visitScriptin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDeclareNamespaceStmt
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.declareNamespaceStmt().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDeclareNamespaceStmtin interfaceLogicalTypesVisitor<Object>- Overrides:
visitDeclareNamespaceStmtin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitAliasStmt
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.aliasStmt().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitAliasStmtin interfaceLogicalTypesVisitor<Object>- Overrides:
visitAliasStmtin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitCreateTypeStmt
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.createTypeStmt().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitCreateTypeStmtin interfaceLogicalTypesVisitor<Object>- Overrides:
visitCreateTypeStmtin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitRegisterTypeStmt
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.registerTypeStmt().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitRegisterTypeStmtin interfaceLogicalTypesVisitor<Object>- Overrides:
visitRegisterTypeStmtin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPrimitiveTypeExpr
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by thePrimitiveTypeExprlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPrimitiveTypeExprin interfaceLogicalTypesVisitor<Object>- Overrides:
visitPrimitiveTypeExprin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitVariantTypeExpr
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by theVariantTypeExprlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitVariantTypeExprin interfaceLogicalTypesVisitor<Object>- Overrides:
visitVariantTypeExprin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitRowTypeExpr
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by theRowTypeExprlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitRowTypeExprin interfaceLogicalTypesVisitor<Object>- Overrides:
visitRowTypeExprin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitUnionTypeExpr
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by theUnionTypeExprlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitUnionTypeExprin interfaceLogicalTypesVisitor<Object>- Overrides:
visitUnionTypeExprin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitMapTypeExpr
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by theMapTypeExprlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitMapTypeExprin interfaceLogicalTypesVisitor<Object>- Overrides:
visitMapTypeExprin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitQualifiedNameExpr
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by theQualifiedNameExprlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitQualifiedNameExprin interfaceLogicalTypesVisitor<Object>- Overrides:
visitQualifiedNameExprin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPrefixArray
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by thePrefixArraylabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPrefixArrayin interfaceLogicalTypesVisitor<Object>- Overrides:
visitPrefixArrayin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPostfixArray
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by thePostfixArraylabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPostfixArrayin interfaceLogicalTypesVisitor<Object>- Overrides:
visitPostfixArrayin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPrefixMultiset
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by thePrefixMultisetlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPrefixMultisetin interfaceLogicalTypesVisitor<Object>- Overrides:
visitPrefixMultisetin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPostfixMultiset
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced by thePostfixMultisetlabeled alternative inLogicalTypesParser.typeExpr().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPostfixMultisetin interfaceLogicalTypesVisitor<Object>- Overrides:
visitPostfixMultisetin classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPrimitiveType
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.primitiveType().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPrimitiveTypein interfaceLogicalTypesVisitor<Object>- Overrides:
visitPrimitiveTypein classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitRowType
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.rowType().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitRowTypein interfaceLogicalTypesVisitor<Object>- Overrides:
visitRowTypein classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitUnionType
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.unionType().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitUnionTypein interfaceLogicalTypesVisitor<Object>- Overrides:
visitUnionTypein classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitMapType
Description copied from class:LogicalTypesBaseVisitorVisit a parse tree produced byLogicalTypesParser.mapType().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitMapTypein interfaceLogicalTypesVisitor<Object>- Overrides:
visitMapTypein classLogicalTypesBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-