public final class RoutineDeclaration extends Object
Its identity is the routine it declares: the name's keys, the namespace it lives in,
and the parameters as far as the vendor tells routines of one name apart by them (RoutineDeclaration.Signature). Two
declarations with one identity are one routine declared twice (CREATE OR REPLACE, a package
specification and its body); where the vendor overloads, a same-named declaration with other parameters is
another routine. Parameter counts are only lookup aliases: a call supplies arguments, not types, and matches
a declaration when the number of arguments lies between its required inputs and its inputs, or equals its
parameter count.
| Modifier and Type | Class and Description |
|---|---|
static class |
RoutineDeclaration.Identity
The identity of a declared routine.
|
static class |
RoutineDeclaration.Signature
How much of its parameter list a vendor identifies a routine by.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptsCount(int count)
Whether a call with
count arguments can be this routine: any count for a routine keyed by its name
alone, else its parameter count, or a count from its required inputs up to its inputs (no upper bound with a
VARIADIC parameter). |
static boolean |
callsCounted(EDbVendor vendor)
Whether a call site keys its lookup with the argument count: some routine of the vendor uses count aliases.
|
RoutineName |
getName() |
CatalogObjectKind |
getNamespace() |
Object |
getOrigin()
The statement or node this occurrence was declared by.
|
Object |
getRepresentative()
The first occurrence of this declaration's identity: the one a later occurrence replaced keeps its place.
|
int |
getTotalCount() |
List<ArgumentTypeKey> |
getTypes() |
boolean |
hasSignatureAliases()
Whether the declaration is keyed with its signature (a lookup by name only reaches it by the fallback).
|
RoutineDeclaration.Identity |
identity() |
static boolean |
identityOverloads(EDbVendor vendor,
CatalogObjectKind kind,
boolean memberOrLocal)
Whether the vendor tells routines of this kind apart by their parameters (their identity is not the name alone).
|
static RoutineDeclaration |
of(Object model,
Object origin,
RoutineName name,
TParameterDeclarationList parameters,
EDbVendor vendor,
IdentifierService service)
of(Object, RoutineName, TParameterDeclarationList, Object, EDbVendor, IdentifierService) for a
top-level routine; model is not kept (the typed registry holds declarations, not legacy models). |
static RoutineDeclaration |
of(Object origin,
RoutineName name,
TParameterDeclarationList parameters,
Object scope,
EDbVendor vendor,
IdentifierService service)
A declaration from its AST:
scope the routine it is local to (null for a top-level or package
routine). |
static RoutineDeclaration |
ofCall(Object origin,
RoutineName name,
Integer argumentCount,
EDbVendor vendor)
A routine known only from a call or an EXEC of a module never defined here: a name and a count.
|
static RoutineDeclaration.Signature |
signatureOf(EDbVendor vendor,
CatalogObjectKind kind,
boolean memberOrLocal)
The signature a vendor identifies a routine of this kind by.
|
String |
toString() |
static boolean |
usesCountAliases(EDbVendor vendor,
CatalogObjectKind kind,
boolean memberOrLocal)
Whether declarations of this kind are keyed with their argument counts, so a call is looked up by its
argument count: where the vendor overloads routines of the kind, and wherever the legacy registry keyed them
so (standalone Oracle routines, MySQL, HANA).
|
public static RoutineDeclaration.Signature signatureOf(EDbVendor vendor, CatalogObjectKind kind, boolean memberOrLocal)
public static boolean identityOverloads(EDbVendor vendor, CatalogObjectKind kind, boolean memberOrLocal)
public static boolean usesCountAliases(EDbVendor vendor, CatalogObjectKind kind, boolean memberOrLocal)
public static boolean callsCounted(EDbVendor vendor)
public static RoutineDeclaration of(Object origin, RoutineName name, TParameterDeclarationList parameters, Object scope, EDbVendor vendor, IdentifierService service)
scope the routine it is local to (null for a top-level or package
routine). A statement with no parameter list (parameters null: Oracle CREATE PROCEDURE p IS,
DB2 CREATE FUNCTION f ()) declares a routine with no parameters.public static RoutineDeclaration of(Object model, Object origin, RoutineName name, TParameterDeclarationList parameters, EDbVendor vendor, IdentifierService service)
of(Object, RoutineName, TParameterDeclarationList, Object, EDbVendor, IdentifierService) for a
top-level routine; model is not kept (the typed registry holds declarations, not legacy models).public static RoutineDeclaration ofCall(Object origin, RoutineName name, Integer argumentCount, EDbVendor vendor)
public Object getRepresentative()
public RoutineName getName()
public CatalogObjectKind getNamespace()
public List<ArgumentTypeKey> getTypes()
public int getTotalCount()
public boolean hasSignatureAliases()
public boolean acceptsCount(int count)
count arguments can be this routine: any count for a routine keyed by its name
alone, else its parameter count, or a count from its required inputs up to its inputs (no upper bound with a
VARIADIC parameter).public RoutineDeclaration.Identity identity()