public Cron validate ( ) { for ( final Map . Entry < CronFieldName , CronField > field : retrieveFieldsAsMap ( ) . entrySet ( ) ) { final CronFieldName fieldName = field . getKey ( ) ; field . getValue ( ) . getExpression ( ) . accept ( new ValidationFieldExpressionVisitor ( getCronDefinition ( ) . getFieldDefinition ( fieldName ) . getConstraints ( ) , cronDefinition . isStrictRanges ( ) ) ) ; } for ( final CronConstraint constraint : getCronDefinition ( ) . getCronConstraints ( ) ) { if ( ! constraint . validate ( this ) ) { throw new IllegalArgumentException ( String . format ( "Invalid cron expression: %s. %s" , asString ( ) , constraint . getDescription ( ) ) ) ; } } return this ; }
Validates this Cron instance by validating its cron expression .