EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[all classes][org.springframework.batch.core.job]

COVERAGE SUMMARY FOR SOURCE FILE [CompositeJobParametersValidator.java]

nameclass, %method, %block, %line, %
CompositeJobParametersValidator.java100% (1/1)75%  (3/4)72%  (23/32)67%  (6/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompositeJobParametersValidator100% (1/1)75%  (3/4)72%  (23/32)67%  (6/9)
afterPropertiesSet (): void 0%   (0/1)0%   (0/9)0%   (0/3)
CompositeJobParametersValidator (): void 100% (1/1)100% (3/3)100% (1/1)
setValidators (List): void 100% (1/1)100% (4/4)100% (2/2)
validate (JobParameters): void 100% (1/1)100% (16/16)100% (3/3)

1/*
2 * Copyright 2011 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.batch.core.job;
17 
18import java.util.List;
19 
20import org.springframework.batch.core.JobParameters;
21import org.springframework.batch.core.JobParametersInvalidException;
22import org.springframework.batch.core.JobParametersValidator;
23import org.springframework.beans.factory.InitializingBean;
24import org.springframework.util.Assert;
25 
26/**
27 * Composite {@link JobParametersValidator} that passes the job parameters through a sequence of
28 * injected <code>JobParametersValidator</code>s 
29 * 
30 * @author Morten Andersen-Gott
31 *
32 */
33public class CompositeJobParametersValidator implements JobParametersValidator, InitializingBean {
34 
35        private List<JobParametersValidator> validators;
36        
37        /**
38         * Validates the JobParameters according to the injected JobParameterValidators
39         * Validation stops and exception is thrown on first validation error
40         * 
41         * @param parameters some {@link JobParameters}
42         * @throws JobParametersInvalidException if the parameters are invalid
43         */
44        public void validate(JobParameters parameters)        throws JobParametersInvalidException {
45                for (JobParametersValidator validator : validators) {
46                        validator.validate(parameters);
47                }
48        }
49        
50        /**
51         * Public setter for the validators
52         * @param validators
53         */
54        public void setValidators(List<JobParametersValidator> validators) {
55                this.validators = validators;
56        }
57 
58        public void afterPropertiesSet() throws Exception {
59                Assert.notNull(validators, "The 'validators' may not be null");
60                Assert.notEmpty(validators, "The 'validators' may not be empty");
61        }
62        
63        
64 
65}

[all classes][org.springframework.batch.core.job]
EMMA 2.0.5312 (C) Vladimir Roubtsov