EMMA Coverage Report (generated Fri Aug 21 15:59:46 BST 2009)
[all classes][org.springframework.batch.core.step.tasklet]

COVERAGE SUMMARY FOR SOURCE FILE [ConfigurableSystemProcessExitCodeMapper.java]

nameclass, %method, %block, %line, %
ConfigurableSystemProcessExitCodeMapper.java100% (1/1)100% (3/3)100% (28/28)100% (8/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConfigurableSystemProcessExitCodeMapper100% (1/1)100% (3/3)100% (28/28)100% (8/8)
ConfigurableSystemProcessExitCodeMapper (): void 100% (1/1)100% (3/3)100% (1/1)
getExitStatus (int): ExitStatus 100% (1/1)100% (17/17)100% (4/4)
setMappings (Map): void 100% (1/1)100% (8/8)100% (3/3)

1/*
2 * Copyright 2006-2007 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 */
16 
17package org.springframework.batch.core.step.tasklet;
18 
19import java.util.Map;
20 
21import org.springframework.batch.core.ExitStatus;
22import org.springframework.util.Assert;
23 
24/**
25 * Maps exit codes to {@link org.springframework.batch.core.ExitStatus} 
26 * according to injected map. The injected map is required to contain a value 
27 * for 'else' key, this value will be returned if the injected map 
28 * does not contain value for the exit code returned by the system process.
29 * 
30 * @author Robert Kasanicky
31 */
32public class ConfigurableSystemProcessExitCodeMapper implements SystemProcessExitCodeMapper {
33        
34        public static final String ELSE_KEY = "else";
35        
36        private Map<Object, ExitStatus> mappings;
37 
38        public ExitStatus getExitStatus(int exitCode) {
39                ExitStatus exitStatus = mappings.get(exitCode);
40                if (exitStatus != null) {
41                        return exitStatus;
42                } else {
43                        return mappings.get(ELSE_KEY);
44                }
45        }
46 
47        /**
48         * @param mappings <code>Integer</code> exit code keys to 
49         * {@link org.springframework.batch.core.ExitStatus} values.
50         */
51        public void setMappings(Map<Object, ExitStatus> mappings) {
52                Assert.notNull(mappings.get(ELSE_KEY));
53                this.mappings = mappings;
54        }
55 
56}

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