EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.core.launch.support]

COVERAGE SUMMARY FOR SOURCE FILE [RunIdIncrementer.java]

nameclass, %method, %block, %line, %
RunIdIncrementer.java100% (1/1)100% (4/4)100% (41/41)100% (8/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RunIdIncrementer100% (1/1)100% (4/4)100% (41/41)100% (8/8)
<static initializer> 100% (1/1)100% (3/3)100% (1/1)
RunIdIncrementer (): void 100% (1/1)100% (6/6)100% (2/2)
getNext (JobParameters): JobParameters 100% (1/1)100% (28/28)100% (3/3)
setKey (String): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 * Copyright 2006-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.launch.support;
17 
18import org.springframework.batch.core.JobParameters;
19import org.springframework.batch.core.JobParametersBuilder;
20import org.springframework.batch.core.JobParametersIncrementer;
21 
22/**
23 * @author Dave Syer
24 */
25public class RunIdIncrementer implements JobParametersIncrementer {
26 
27        private static String RUN_ID_KEY = "run.id";
28 
29        private String key = RUN_ID_KEY;
30 
31        /**
32         * The name of the run id in the job parameters.  Defaults to "run.id".
33         *
34         * @param key the key to set
35         */
36        public void setKey(String key) {
37                this.key = key;
38        }
39 
40        /**
41         * Increment the run.id parameter (starting with 1).
42         */
43        @Override
44        public JobParameters getNext(JobParameters parameters) {
45 
46                JobParameters params = (parameters == null) ? new JobParameters() : parameters;
47 
48                long id = params.getLong(key, 0L) + 1;
49                return new JobParametersBuilder(params).addLong(key, id).toJobParameters();
50        }
51 
52}

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