private boolean validateSize ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } int objectSize = 0 ; int minSize = ( ( Size ) annotate ) . min ( ) ; int maxSize = ( ( Size ) annotate ) . max ( ) ; if ( validationObject != null ) { if ( String . class . isAssignableFrom ( validationObject . getClass ( ) ) ) { objectSize = ( ( String ) validationObject ) . length ( ) ; } else if ( Collection . class . isAssignableFrom ( validationObject . getClass ( ) ) ) { objectSize = ( ( Collection ) validationObject ) . size ( ) ; } else if ( Map . class . isAssignableFrom ( validationObject . getClass ( ) ) ) { objectSize = ( ( Map ) validationObject ) . size ( ) ; } else if ( ArrayList . class . isAssignableFrom ( validationObject . getClass ( ) ) ) { objectSize = ( ( ArrayList ) validationObject ) . size ( ) ; } else { throwValidationException ( ( ( Size ) annotate ) . message ( ) ) ; } } return objectSize <= maxSize && objectSize >= minSize ; }
Checks whether the given attribute s value is within specified limit