@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) void complete ( ) { if ( this . range != null ) { AbstractValidatorRange validator = null ; if ( this . valueType != null ) { Class < ? > valueClass = this . valueType . getAssignmentClass ( ) ; if ( this . valueType . isCollection ( ) ) { validator = new ValidatorCollectionSize ( this . range ) ; } else if ( this . valueType . isMap ( ) ) { validator = new ValidatorMapSize ( this . range ) ; } else if ( this . valueType . getComponentType ( ) != null ) { validator = new ValidatorArrayLength ( this . range ) ; } else if ( this . mathUtil . getNumberType ( valueClass ) != null ) { validator = new ValidatorRange <> ( this . range ) ; } } if ( validator == null ) { validator = new ValidatorRangeGeneric <> ( this . range ) ; } this . validatorRegistry . add ( validator ) ; } }
Has to be called at the end to complete the processing .