import { CommonValidatorBuilderImpl , NumberValidatorBuilder , ValidationOptionsBuilder } from "./" ; import { ValidationRule } from "../validation" ; import { PropertyValidator } from "../validators/PropertyValidator" ; import { IsGreaterThanOrEqualToValidator , IsGreaterThanValidator , IsLessThanOrEqualToValidator , IsLessThanValidator , IsNegativeValidator , IsPositiveValidator } from "../validators/number-based" ; export class NumberValidatorBuilderImpl < T > extends CommonValidatorBuilderImpl < T , number > implements NumberValidatorBuilder < T > { constructor ( validationRule ) { super ( validationRule ) ; } private buildRuleWith ( validator ) { this . validationRule . addValidator ( validator ) ; return this ; } isPositive ( ) { return this . buildRuleWith ( new IsPositiveValidator ( ) ) ; } isNegative ( ) { return this . buildRuleWith ( new IsNegativeValidator ( ) ) ; } isGreaterThan ( threshold ) { return this . buildRuleWith ( new IsGreaterThanValidator ( threshold ) ) ; } isGreaterThanOrEqual ( threshold ) { return this . buildRuleWith ( new IsGreaterThanOrEqualToValidator ( threshold ) ) ; } isLessThan ( threshold ) { return this . buildRuleWith ( new IsLessThanValidator ( threshold ) ) ; } isLessThanOrEqual ( threshold ) { return this . buildRuleWith ( new IsLessThanOrEqualToValidator ( threshold ) ) ; } }