Class MetaFunction
java.lang.Object
org.pgcodekeeper.core.schema.meta.MetaStatement
org.pgcodekeeper.core.schema.meta.MetaFunction
- All Implemented Interfaces:
Serializable,IFunction,ISearchPath,IStatement
Represents a database function metadata object.
Stores information about function signatures, arguments, return types,
and special properties like SETOF functions and aggregate order by clauses.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMetaFunction(String schemaName, String name, String bareName) Creates a new function metadata object.MetaFunction(PgObjLocation object, String bareName) Creates a new function metadata object with location information. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArgument(Argument arg) Adds an argument to this function.voidaddOrderBy(Argument type) Adds an ORDER BY argument for aggregate functions.voidaddReturnsColumn(String name, String type) Adds a column to the returns table for table-returning functions.Gets the list of function arguments.Gets the bare name without qualifiers or arguments.Returns the containing schema of this function.getName()Alias forgetSignature()which provides a unique function ID.Gets the return type of this function.Gets the return columns for table-valued functions.Returns the schema name of this function.Returns function signature.booleanisSetof()Returns whether this function returns a set of values.voidsetReturns(String returns) Sets the return type of this function.voidsetSetof(boolean setof) Methods inherited from class org.pgcodekeeper.core.schema.meta.MetaStatement
getComment, getDatabase, getFilePath, getGenericColumn, getLineNumber, getObject, getObjLength, getOffset, getParent, getQualifiedName, getStatementType, setCommentMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabaseMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getComment, getParent, getQualifiedName, getStatementType
-
Constructor Details
-
MetaFunction
Creates a new function metadata object with location information.- Parameters:
object- the object location informationbareName- the bare function name without signature
-
MetaFunction
Creates a new function metadata object.- Parameters:
schemaName- the schema namename- the function name (typically the signature)bareName- the bare function name without signature
-
-
Method Details
-
getReturnsColumns
Description copied from interface:IFunctionGets the return columns for table-valued functions.- Specified by:
getReturnsColumnsin interfaceIFunction- Returns:
- a map of column names to their types
-
addReturnsColumn
Adds a column to the returns table for table-returning functions.- Parameters:
name- the column nametype- the column type
-
getArguments
Description copied from interface:IFunctionGets the list of function arguments.- Specified by:
getArgumentsin interfaceIFunction- Returns:
- the list of arguments
-
addArgument
Adds an argument to this function.- Parameters:
arg- the argument to add
-
isSetof
public boolean isSetof()Returns whether this function returns a set of values.- Returns:
- true if this is a SETOF function, false otherwise
-
setSetof
public void setSetof(boolean setof) -
addOrderBy
Adds an ORDER BY argument for aggregate functions.- Parameters:
type- the order by argument
-
getReturns
Description copied from interface:IFunctionGets the return type of this function.- Specified by:
getReturnsin interfaceIFunction- Returns:
- the return type, or null if not applicable
-
setReturns
Description copied from interface:IFunctionSets the return type of this function.- Specified by:
setReturnsin interfaceIFunction- Parameters:
returns- the return type to set
-
getName
Alias forgetSignature()which provides a unique function ID.Use
getBareName()to get just the function name.- Specified by:
getNamein interfaceIStatement- Overrides:
getNamein classMetaStatement- Returns:
- the statement name
-
getBareName
Description copied from interface:IStatementGets the bare name without qualifiers or arguments.- Specified by:
getBareNamein interfaceIStatement- Overrides:
getBareNamein classMetaStatement- Returns:
- the bare name
-
getSignature
Returns function signature. It consists of unquoted name and argument data types.- Returns:
- function signature
-
getContainingSchema
Returns the containing schema of this function. This operation is not supported for metadata functions.- Specified by:
getContainingSchemain interfaceISearchPath- Returns:
- never returns normally
- Throws:
IllegalStateException- always thrown as this operation is unsupported
-
getSchemaName
Returns the schema name of this function.- Specified by:
getSchemaNamein interfaceISearchPath- Returns:
- the schema name
-