Class PipeParameterValidator
java.lang.Object
org.apache.iotdb.pipe.api.customizer.parameter.PipeParameterValidator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidate(PipeParameterValidator.MultipleObjectsValidationRule validationRule, String messageToThrow, Object... arguments) Validates the input parameters according to the validation rule given by the user.validate(PipeParameterValidator.SingleObjectValidationRule validationRule, String messageToThrow, Object argument) Validates the input parameters according to the validation rule given by the user.validateAttributeValueRange(String key, boolean canBeOptional, String... optionalValues) Validates whether the attributes entered by the user contain an attribute whose key is attributeKey.validateSynonymAttributes(List<String> lhsAttributes, List<String> rhsAttributes, boolean isRequired) Validates whether the attributes entered by the user contain at least one attribute from lhsAttributes or rhsAttributes (if required), but not both.
-
Constructor Details
-
PipeParameterValidator
-
-
Method Details
-
getParameters
-
validateSynonymAttributes
public PipeParameterValidator validateSynonymAttributes(List<String> lhsAttributes, List<String> rhsAttributes, boolean isRequired) Validates whether the attributes entered by the user contain at least one attribute from lhsAttributes or rhsAttributes (if required), but not both.- Parameters:
lhsAttributes- list of left-hand side synonym attributesrhsAttributes- list of right-hand side synonym attributesisRequired- specifies whether at least one attribute from lhsAttributes or rhsAttributes must be provided- Returns:
- the instance of PipeParameterValidator for method chaining
- Throws:
PipeParameterNotValidException- if both lhsAttributes and rhsAttributes are providedPipeAttributeNotProvidedException- if isRequired is true and neither lhsAttributes nor rhsAttributes are provided
-
validateRequiredAttribute
public PipeParameterValidator validateRequiredAttribute(String key) throws PipeAttributeNotProvidedException Validates whether the attributes entered by the user contain an attribute whose key is attributeKey.- Parameters:
key- key of the attribute- Throws:
PipeAttributeNotProvidedException- if the attribute is not provided
-
validateAttributeValueRange
public PipeParameterValidator validateAttributeValueRange(String key, boolean canBeOptional, String... optionalValues) throws PipeAttributeNotProvidedException -
validate
public PipeParameterValidator validate(PipeParameterValidator.SingleObjectValidationRule validationRule, String messageToThrow, Object argument) throws PipeParameterNotValidException 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:
PipeParameterNotValidException- if the given argument is not valid
-
validate
public PipeParameterValidator validate(PipeParameterValidator.MultipleObjectsValidationRule validationRule, String messageToThrow, Object... arguments) throws PipeParameterNotValidException 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:
PipeParameterNotValidException- if the given arguments are not valid
-