Class UDFParameterValidator
- java.lang.Object
-
- org.apache.iotdb.udf.api.customizer.parameter.UDFParameterValidator
-
public class UDFParameterValidator extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceUDFParameterValidator.MultipleObjectsValidationRulestatic interfaceUDFParameterValidator.SingleObjectValidationRule
-
Constructor Summary
Constructors Constructor Description UDFParameterValidator(UDFParameters parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UDFParametersgetParameters()UDFParameterValidatorvalidate(UDFParameterValidator.MultipleObjectsValidationRule validationRule, java.lang.String messageToThrow, java.lang.Object... arguments)Validates the input parameters according to the validation rule given by the user.UDFParameterValidatorvalidate(UDFParameterValidator.SingleObjectValidationRule validationRule, java.lang.String messageToThrow, java.lang.Object argument)Validates the input parameters according to the validation rule given by the user.UDFParameterValidatorvalidateInputSeriesDataType(int index, Type expectedDataType)Validates whether the data type of the input series at the specified column is as expected.UDFParameterValidatorvalidateInputSeriesDataType(int index, Type... expectedDataTypes)Validates whether the data type of the input series at the specified column is as expected.UDFParameterValidatorvalidateInputSeriesNumber(int expectedSeriesNumber)Validates whether the number of the input series is as expected.UDFParameterValidatorvalidateInputSeriesNumber(int expectedSeriesNumberLowerBound, int expectedSeriesNumberUpperBound)Validates whether the number of the input series is as expected.UDFParameterValidatorvalidateRequiredAttribute(java.lang.String attributeKey)Validates whether the attributes entered by the user contain an attribute whose key is attributeKey.
-
-
-
Constructor Detail
-
UDFParameterValidator
public UDFParameterValidator(UDFParameters parameters)
-
-
Method Detail
-
getParameters
public UDFParameters getParameters()
-
validateRequiredAttribute
public UDFParameterValidator validateRequiredAttribute(java.lang.String attributeKey) throws UDFAttributeNotProvidedException
Validates whether the attributes entered by the user contain an attribute whose key is attributeKey.- Parameters:
attributeKey- key of the attribute- Throws:
UDFAttributeNotProvidedException- if the attribute is not provided
-
validateInputSeriesDataType
public UDFParameterValidator validateInputSeriesDataType(int index, Type expectedDataType) throws UDFException
Validates whether the data type of the input series at the specified column is as expected.- Parameters:
index- index of the specified columnexpectedDataType- the expected data type- Throws:
UDFInputSeriesIndexNotValidException- if the index of the specified column is out of boundUDFInputSeriesDataTypeNotValidException- if the data type of the input series at the specified column is not as expectedUDFException
-
validateInputSeriesDataType
public UDFParameterValidator validateInputSeriesDataType(int index, Type... expectedDataTypes) throws UDFException
Validates whether the data type of the input series at the specified column is as expected.- Parameters:
index- index of the specified columnexpectedDataTypes- the expected data types- Throws:
UDFInputSeriesIndexNotValidException- if the index of the specified column is out of boundUDFInputSeriesDataTypeNotValidException- if the data type of the input series at the specified column is not as expectedUDFException
-
validateInputSeriesNumber
public UDFParameterValidator validateInputSeriesNumber(int expectedSeriesNumber) throws UDFInputSeriesNumberNotValidException
Validates whether the number of the input series is as expected.- Parameters:
expectedSeriesNumber- the expected number of the input series- Throws:
UDFInputSeriesNumberNotValidException- if the number of the input series is not as expected
-
validateInputSeriesNumber
public UDFParameterValidator validateInputSeriesNumber(int expectedSeriesNumberLowerBound, int expectedSeriesNumberUpperBound) throws UDFInputSeriesNumberNotValidException
Validates whether the number of the input series is as expected.- Parameters:
expectedSeriesNumberLowerBound- the number of the input series must be greater than or equal to the expectedSeriesNumberLowerBoundexpectedSeriesNumberUpperBound- the number of the input series must be less than or equal to the expectedSeriesNumberUpperBound- Throws:
UDFInputSeriesNumberNotValidException- if the number of the input series is not as expected
-
validate
public UDFParameterValidator validate(UDFParameterValidator.SingleObjectValidationRule validationRule, java.lang.String messageToThrow, java.lang.Object argument) throws UDFParameterNotValidException
Validates the input parameters according to the validation rule given by the user.- Parameters:
validationRule- the validation rule, which can be a lambda expressionmessageToThrow- the message to throw when the given argument is not validargument- the given argument- Throws:
UDFParameterNotValidException- if the given argument is not valid
-
validate
public UDFParameterValidator validate(UDFParameterValidator.MultipleObjectsValidationRule validationRule, java.lang.String messageToThrow, java.lang.Object... arguments) throws UDFParameterNotValidException
Validates the input parameters according to the validation rule given by the user.- Parameters:
validationRule- the validation rule, which can be a lambda expressionmessageToThrow- the message to throw when the given arguments are not validarguments- the given arguments- Throws:
UDFParameterNotValidException- if the given arguments are not valid
-
-