EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[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)70%  (7/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompositeJobParametersValidator100% (1/1)75%  (3/4)72%  (23/32)70%  (7/10)
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% (4/4)

1/*
2 * Copyright 2011-2013 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        @Override
45        public void validate(JobParameters parameters)        throws JobParametersInvalidException {
46                for (JobParametersValidator validator : validators) {
47                        validator.validate(parameters);
48                }
49        }
50 
51        /**
52         * Public setter for the validators
53         * @param validators
54         */
55        public void setValidators(List<JobParametersValidator> validators) {
56                this.validators = validators;
57        }
58 
59        @Override
60        public void afterPropertiesSet() throws Exception {
61                Assert.notNull(validators, "The 'validators' may not be null");
62                Assert.notEmpty(validators, "The 'validators' may not be empty");
63        }
64 
65 
66 
67}

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