Package no.sikt.graphitron.mappings
Class RoutineReflection
java.lang.Object
no.sikt.graphitron.mappings.SchemaReflection
no.sikt.graphitron.mappings.RoutineReflection
Helper class that takes care of any routine reflection operations the code generator might require towards the jOOQ source.
Discovers and provides access to stored procedures and functions generated by jOOQ.
Routines are keyed internally by a schema-qualified name (schema.SimpleClassName, lowercased) so that routines
with the same name in different database schemas do not collide.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.jooq.Parameter<?>> getInParameters(String qualifiedKey) static List<org.jooq.Parameter<?>> getOutParameters(String qualifiedKey) getReturnType(String qualifiedKey) getRoutineMethodName(String qualifiedKey) Derives the name of the convenience static method on the generatedRoutinesclass for a given routine.getRoutinesClassName(String qualifiedKey) Derives the fully qualified name of the generatedRoutinesclass that holds the convenience static methods for the given routine.static booleanisFunction(String qualifiedKey) resolveRoutine(String userSuppliedName) Resolves a user-supplied routine name against the discovered routines, returning the list of matching qualified keys (schema.SimpleClassName, lowercased).static StringschemaFromProcedure(String qualifiedProcedure) Returns the schema portion of a qualified routine key (the part before the dot).Methods inherited from class no.sikt.graphitron.mappings.SchemaReflection
getClassFromSchemaPackage, getDefaultCatalog, getFieldsFromSchemaClass, getJavaFieldName, getJavaFieldValue
-
Constructor Details
-
RoutineReflection
public RoutineReflection()
-
-
Method Details
-
resolveRoutine
Resolves a user-supplied routine name against the discovered routines, returning the list of matching qualified keys (schema.SimpleClassName, lowercased). The name may be bare (foo) or schema-qualified (my_schema.foo). Matching is case-insensitive.An empty list means no match; a single entry is unambiguous; multiple entries indicate the bare name is ambiguous across schemas and the caller must disambiguate.
-
schemaFromProcedure
Returns the schema portion of a qualified routine key (the part before the dot). -
isFunction
- Returns:
- Whether the routine is a function (has a return).
-
getInParameters
- Returns:
- The IN parameters of the routine (excluding return).
-
getOutParameters
- Returns:
- The OUT parameters of the routine (excluding return).
-
getReturnType
- Returns:
- The Java return type of the routine, if it is a function.
-
getRoutinesClassName
Derives the fully qualified name of the generatedRoutinesclass that holds the convenience static methods for the given routine. The class lives one package up from the individual routine class (the schema package).Assumes the jOOQ convention where each routine class lives at
<schema>.routines.XYZ; a routine placed directly in the schema package would cause this to derive an incorrect parent package.- Returns:
- The fully qualified class name of
Routines, or empty if no such routine exists.
-
getRoutineMethodName
Derives the name of the convenience static method on the generatedRoutinesclass for a given routine. jOOQ emits the method as a camelCased version of the routine's Java class name (e.g.InventoryHeldByCustomerbecomesinventoryHeldByCustomer, and_GroupConcatbecomes_GroupConcat).- Returns:
- The method name on the generated
Routinesclass, or empty if no such routine exists.
-