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 classFunctionMethod.DeterminismDETERMINISTIC - 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 classFunctionMethod.PushDownFunction 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>inParametersstatic StringSYSTEM_NAMEstatic StringVIRTUAL_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 voidconvertExtensionMetadata(Procedure procedureRecord, FunctionMethod function)static FunctionMethodcreateFunctionMethod(String name, String description, String category, String returnType, String... paramTypes)booleanequals(Object obj)Compare other object for equality.AggregateAttributesgetAggregateAttributes()Gets theAggregateAttributesfor this function if it represents an aggregate function.StringgetCategory()Get category of methodStringgetDescription()Get description of methodFunctionMethod.DeterminismgetDeterminism()StringgetIdentifier()Get a context unique identifier for this object.intgetInputParameterCount()Get a count of the input parameters.List<FunctionParameter>getInputParameters()Get input parametersStringgetInvocationClass()Get invocation class nameStringgetInvocationMethod()Get invocation method nameMethodgetMethod()FunctionParametergetOutputParameter()Get output/return parameter.SchemagetParent()FunctionMethod.PushDowngetPushdown()Get pushdown property of methodinthashCode()Get hash code for this object.booleanisNullOnNull()Returns true if the function returns null on any null inputbooleanisVarArgs()voidsetAggregateAttributes(AggregateAttributes aggregateAttributes)voidsetCategory(String category)Set category of methodvoidsetDescription(String description)Set description of methodvoidsetDeterminism(FunctionMethod.Determinism determinism)voidsetDeterministicBoolean(boolean deterministic)voidsetInputParameters(List<FunctionParameter> params)Set input parameters.voidsetInvocationClass(String invocationClass)Set invocation class namevoidsetInvocationMethod(String invocationMethod)Set invocation method namevoidsetMethod(Method method)voidsetNullOnNull(boolean nullOnNull)voidsetOutputParameter(FunctionParameter param)Set output/return parameter.voidsetParent(Schema parent)voidsetPushdown(FunctionMethod.PushDown pushdown)Set pushdown property of methodvoidsetPushDown(String pushdown)booleansetVarArgs(boolean varargs)StringtoString()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:
hashCodein 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:
equalsin classAbstractMetadataRecord- Returns:
- True if object equals this object according to conditions
-
toString
public String toString()
Return string version for debugging purposes- Overrides:
toStringin 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:
getParentin classAbstractMetadataRecord
-
getAggregateAttributes
public AggregateAttributes getAggregateAttributes()
Gets theAggregateAttributesfor 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:AbstractMetadataRecordGet a context unique identifier for this object. Typically it's just the name.- Overrides:
getIdentifierin classAbstractMetadataRecord- Returns:
-
-