Class FunctionMetadataValidator
- java.lang.Object
-
- org.teiid.query.function.metadata.FunctionMetadataValidator
-
public class FunctionMetadataValidator extends Object
The validator encodes business logic with respect to what a valid function description is. These methods call each other from the most complex components (FunctionMethod) to the simplest pieces (function name). Certain users of the validator may only need to call lower level methods.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_LENGTHMaximum length for function names, parameter names, categories, and descriptions.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidvalidateCategory(String category)Determine whether a category is valid.static voidvalidateDescription(String description)Determine whether a description is valid.static voidvalidateFunctionMethod(FunctionMethod method, ValidatorReport report, Map<String,Datatype> runtimeTypeMap)Determine whether a FunctionMethod is valid.static voidvalidateFunctionMethods(Collection<FunctionMethod> methods, ValidatorReport report)Validate a collection ofFunctionMethodobjects.static voidvalidateFunctionMethods(Collection<FunctionMethod> methods, ValidatorReport report, Map<String,Datatype> runtimeTypeMap)static voidvalidateFunctionParameter(FunctionParameter param)Determine whether a FunctionParameter is valid.static voidvalidateInvocationMethod(String invocationClass, String invocationMethod, FunctionMethod.PushDown pushdown)Determine whether an invocation class and method are valid.static voidvalidateName(String name)Determine whether a function or parameter name is valid.
-
-
-
Field Detail
-
MAX_LENGTH
public static final int MAX_LENGTH
Maximum length for function names, parameter names, categories, and descriptions.- See Also:
- Constant Field Values
-
-
Method Detail
-
validateFunctionMethods
public static final void validateFunctionMethods(Collection<FunctionMethod> methods, ValidatorReport report)
Validate a collection ofFunctionMethodobjects.- Parameters:
methods- Collection ofFunctionMethodobjectsreport- Report to store validation errors
-
validateFunctionMethods
public static final void validateFunctionMethods(Collection<FunctionMethod> methods, ValidatorReport report, Map<String,Datatype> runtimeTypeMap)
-
validateFunctionMethod
public static final void validateFunctionMethod(FunctionMethod method, ValidatorReport report, Map<String,Datatype> runtimeTypeMap)
Determine whether a FunctionMethod is valid. The following items are validated:- Validate method name
- Validate description
- Validate category
- Validate invocation method
- Validate all input parameters
- Validate output parameter
- Parameters:
method- The method to validatereport- The report to update during validation
-
validateFunctionParameter
public static final void validateFunctionParameter(FunctionParameter param) throws FunctionMetadataException
Determine whether a FunctionParameter is valid. The following items are validated:- Validate parameter name
- Validate description
- Validate type
- Parameters:
param- The parameter to validate- Throws:
FunctionMetadataException- Thrown if function parameter is not valid in some way
-
validateName
public static final void validateName(String name) throws FunctionMetadataException
Determine whether a function or parameter name is valid. The following items are validated:- Validate that name is not null
- Validate that name has length <= MAX_LENGTH
- Validate that name starts with alphabetic character
- Validate that name contains only valid characters: letters, numbers, and _
- Parameters:
name- Name to validate- Throws:
FunctionMetadataException- Thrown if function or parameter name is not valid in some way
-
validateDescription
public static final void validateDescription(String description) throws FunctionMetadataException
Determine whether a description is valid. The following items are validated:- Validate that description (if not null) has length <= 4000
- Parameters:
description- Description to validate- Throws:
FunctionMetadataException- Thrown if description is not valid in some way
-
validateCategory
public static final void validateCategory(String category) throws FunctionMetadataException
Determine whether a category is valid. The following items are validated:- Validate that category is not null
- Validate that category has length <= MAX_LENGTH
- Parameters:
category- Category to validate- Throws:
FunctionMetadataException- Thrown if category is not valid in some way
-
validateInvocationMethod
public static final void validateInvocationMethod(String invocationClass, String invocationMethod, FunctionMethod.PushDown pushdown) throws FunctionMetadataException
Determine whether an invocation class and method are valid. The following items are validated:- Validate that invocation class is not null
- Validate that invocation method is not null
- Validate that class is valid Java class name
- Validate that method is valid Java method name
- Parameters:
invocationClass- Invocation class to validateinvocationMethod- Invocation method to validate- Throws:
FunctionMetadataException- Thrown if invocation method is not valid in some way
-
-