Package org.teiid.metadata
Class FunctionMethod
- java.lang.Object
-
- org.teiid.metadata.AbstractMetadataRecord
-
- org.teiid.metadata.FunctionMethod
-
- All Implemented Interfaces:
Serializable
public class FunctionMethod extends AbstractMetadataRecord
This class represents information about a particular function signature. Function signatures are unique with respect to their name, # of arguments, and type of arguments. Return type and argument names are not uniqueness factors. This class makes no attempt to validate the data put into it, particularly with respect to null values. Attributes:
- name - Name of the function
- description - Description of the function
- category - Function category containing this function
- pushdown - Determine whether this function can, cannot, or must be pushed down to a source
- invocationClass - Class containing method implementing this function
- invocationMethod - Method implementing this function
- inputParameters - 0 or more input parameters
- outputParameter - 1 output parameter
- determinism - specifies whether the function is deterministic or not. Various levels are provided
- nullOnNull - Specifies whether the function is called if any of the input arguments is null. The result is the null value.
- See Also:
FunctionParameter
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FunctionMethod.Determinism
DETERMINISTIC - normal deterministic functions vdb - lookup (however lookup values can be flushed at any time), current_database session - env, user command - command payload never - rand, etc.static class
FunctionMethod.PushDown
Function Pushdown CAN_PUSHDOWN = If the source supports the function, then it will be pushed down.-
Nested classes/interfaces inherited from class org.teiid.metadata.AbstractMetadataRecord
AbstractMetadataRecord.DataModifiable, AbstractMetadataRecord.Modifiable
-
-
Field Summary
Fields Modifier and Type Field Description protected List<FunctionParameter>
inParameters
static String
SYSTEM_NAME
static String
VIRTUAL_FUNCTION
-
Fields inherited from class org.teiid.metadata.AbstractMetadataRecord
NAME_DELIM_CHAR, RELATIONAL_PREFIX
-
-
Constructor Summary
Constructors Constructor Description FunctionMethod()
FunctionMethod(String name, String description, String category, String invocationClass, String invocationMethod, FunctionParameter[] inputParams, FunctionParameter outputParam)
FunctionMethod(String name, String description, String category, FunctionMethod.PushDown pushdown, String invocationClass, String invocationMethod, List<FunctionParameter> inputParams, FunctionParameter outputParam, boolean nullOnNull, FunctionMethod.Determinism deterministic)
FunctionMethod(String name, String description, String category, FunctionParameter[] inputParams, FunctionParameter outputParam)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
convertExtensionMetadata(Procedure procedureRecord, FunctionMethod function)
static FunctionMethod
createFunctionMethod(String name, String description, String category, String returnType, String... paramTypes)
boolean
equals(Object obj)
Compare other object for equality.AggregateAttributes
getAggregateAttributes()
Gets theAggregateAttributes
for this function if it represents an aggregate function.String
getCategory()
Get category of methodString
getDescription()
Get description of methodFunctionMethod.Determinism
getDeterminism()
String
getIdentifier()
Get a context unique identifier for this object.int
getInputParameterCount()
Get a count of the input parameters.List<FunctionParameter>
getInputParameters()
Get input parametersString
getInvocationClass()
Get invocation class nameString
getInvocationMethod()
Get invocation method nameMethod
getMethod()
FunctionParameter
getOutputParameter()
Get output/return parameter.Schema
getParent()
FunctionMethod.PushDown
getPushdown()
Get pushdown property of methodint
hashCode()
Get hash code for this object.boolean
isNullOnNull()
Returns true if the function returns null on any null inputboolean
isVarArgs()
void
setAggregateAttributes(AggregateAttributes aggregateAttributes)
void
setCategory(String category)
Set category of methodvoid
setDescription(String description)
Set description of methodvoid
setDeterminism(FunctionMethod.Determinism determinism)
void
setDeterministicBoolean(boolean deterministic)
void
setInputParameters(List<FunctionParameter> params)
Set input parameters.void
setInvocationClass(String invocationClass)
Set invocation class namevoid
setInvocationMethod(String invocationMethod)
Set invocation method namevoid
setMethod(Method method)
void
setNullOnNull(boolean nullOnNull)
void
setOutputParameter(FunctionParameter param)
Set output/return parameter.void
setParent(Schema parent)
void
setPushdown(FunctionMethod.PushDown pushdown)
Set pushdown property of methodvoid
setPushDown(String pushdown)
boolean
setVarArgs(boolean varargs)
String
toString()
Return string version for debugging purposes-
Methods inherited from class org.teiid.metadata.AbstractMetadataRecord
getAnnotation, getCanonicalName, getFullName, getIncomingObjects, getName, getNameInSource, getProperties, getProperty, getProperty, getSourceName, getSQLString, getSQLString, getUUID, isUUIDSet, setAnnotation, setIncomingObjects, setName, setNameInSource, setProperties, setProperty, setUUID
-
-
-
-
Field Detail
-
SYSTEM_NAME
public static final String SYSTEM_NAME
- See Also:
- Constant Field Values
-
VIRTUAL_FUNCTION
public static final String VIRTUAL_FUNCTION
- See Also:
- Constant Field Values
-
inParameters
protected List<FunctionParameter> inParameters
-
-
Constructor Detail
-
FunctionMethod
public FunctionMethod()
-
FunctionMethod
public FunctionMethod(String name, String description, String category, FunctionParameter[] inputParams, FunctionParameter outputParam)
-
FunctionMethod
public FunctionMethod(String name, String description, String category, FunctionMethod.PushDown pushdown, String invocationClass, String invocationMethod, List<FunctionParameter> inputParams, FunctionParameter outputParam, boolean nullOnNull, FunctionMethod.Determinism deterministic)
-
FunctionMethod
public FunctionMethod(String name, String description, String category, String invocationClass, String invocationMethod, FunctionParameter[] inputParams, FunctionParameter outputParam)
-
-
Method Detail
-
getDescription
public String getDescription()
Get description of method- Returns:
- Description
-
setDescription
public void setDescription(String description)
Set description of method- Parameters:
description
- Description
-
getCategory
public String getCategory()
Get category of method- Returns:
- Category
-
setCategory
public void setCategory(String category)
Set category of method- Parameters:
category
- Category
-
getPushdown
public FunctionMethod.PushDown getPushdown()
Get pushdown property of method- Returns:
- One of the FunctionMethod constants for pushdown
-
setPushdown
public void setPushdown(FunctionMethod.PushDown pushdown)
Set pushdown property of method- Parameters:
pushdown
- One of the FunctionMethod constants for pushdown
-
setPushDown
public void setPushDown(String pushdown)
-
getInvocationClass
public String getInvocationClass()
Get invocation class name- Returns:
- Invocation class name
-
setInvocationClass
public void setInvocationClass(String invocationClass)
Set invocation class name- Parameters:
invocationClass
- Invocation class name
-
getInvocationMethod
public String getInvocationMethod()
Get invocation method name- Returns:
- Invocation method name
-
setInvocationMethod
public void setInvocationMethod(String invocationMethod)
Set invocation method name- Parameters:
invocationMethod
- Invocation method name
-
getInputParameterCount
public int getInputParameterCount()
Get a count of the input parameters.- Returns:
- Number of input parameters
-
getInputParameters
public List<FunctionParameter> getInputParameters()
Get input parameters- Returns:
- Array of input parameters, may be null if 0 parameters
-
setInputParameters
public void setInputParameters(List<FunctionParameter> params)
Set input parameters.- Parameters:
params
- Input parameters
-
getOutputParameter
public FunctionParameter getOutputParameter()
Get output/return parameter.- Returns:
- Output parameter or return argument
-
setOutputParameter
public void setOutputParameter(FunctionParameter param)
Set output/return parameter.- Parameters:
param
- Output Parameter
-
hashCode
public int hashCode()
Get hash code for this object. The hash code is based on the name and input parameters. WARNING: Changing the name or input parameters will change the hash code. If this occurs after the object has been placed in a HashSet or HashMap, the object will be lost!!!! In that case, the object must be added to the hashed collection again.- Overrides:
hashCode
in classAbstractMetadataRecord
- Returns:
- Hash code, based on name and input parameters
-
equals
public boolean equals(Object obj)
Compare other object for equality. This object is equal to another FunctionMethod if 1) Name of function matches (case-insensitive), 2) number of input parameters matches and 3) types of input parameters match.- Overrides:
equals
in classAbstractMetadataRecord
- Returns:
- True if object equals this object according to conditions
-
toString
public String toString()
Return string version for debugging purposes- Overrides:
toString
in classAbstractMetadataRecord
- Returns:
- String representation of function method
-
isNullOnNull
public boolean isNullOnNull()
Returns true if the function returns null on any null input
-
setNullOnNull
public void setNullOnNull(boolean nullOnNull)
-
getDeterminism
public FunctionMethod.Determinism getDeterminism()
-
setDeterministicBoolean
public void setDeterministicBoolean(boolean deterministic)
-
setDeterminism
public void setDeterminism(FunctionMethod.Determinism determinism)
-
isVarArgs
public boolean isVarArgs()
-
setVarArgs
public boolean setVarArgs(boolean varargs)
- Parameters:
varargs
-- Returns:
- true if the value was successfully set.
-
setParent
public void setParent(Schema parent)
-
getParent
public Schema getParent()
- Overrides:
getParent
in classAbstractMetadataRecord
-
getAggregateAttributes
public AggregateAttributes getAggregateAttributes()
Gets theAggregateAttributes
for this function if it represents an aggregate function. Must be null for non-aggregates.- Returns:
-
setAggregateAttributes
public void setAggregateAttributes(AggregateAttributes aggregateAttributes)
-
createFunctionMethod
public static FunctionMethod createFunctionMethod(String name, String description, String category, String returnType, String... paramTypes)
-
convertExtensionMetadata
public static void convertExtensionMetadata(Procedure procedureRecord, FunctionMethod function)
-
getMethod
public Method getMethod()
-
setMethod
public void setMethod(Method method)
-
getIdentifier
public String getIdentifier()
Description copied from class:AbstractMetadataRecord
Get a context unique identifier for this object. Typically it's just the name.- Overrides:
getIdentifier
in classAbstractMetadataRecord
- Returns:
-
-