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

COVERAGE SUMMARY FOR SOURCE FILE [ExecutionContextUserSupport.java]

nameclass, %method, %block, %line, %
ExecutionContextUserSupport.java100% (1/1)60%  (3/5)72%  (23/32)60%  (6/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExecutionContextUserSupport100% (1/1)60%  (3/5)72%  (23/32)60%  (6/10)
ExecutionContextUserSupport (String): void 0%   (0/1)0%   (0/6)0%   (0/3)
getName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
ExecutionContextUserSupport (): void 100% (1/1)100% (3/3)100% (2/2)
getKey (String): String 100% (1/1)100% (16/16)100% (2/2)
setName (String): void 100% (1/1)100% (4/4)100% (2/2)

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 */
16package org.springframework.batch.item.util;
17 
18import org.springframework.batch.item.ExecutionContext;
19import org.springframework.util.Assert;
20 
21/**
22 * Facilitates assigning names to objects persisting data in {@link ExecutionContext} and generating keys for
23 * {@link ExecutionContext} based on the name.
24 * 
25 * @author Robert Kasanicky
26 */
27public class ExecutionContextUserSupport {
28 
29        private String name;
30 
31        public ExecutionContextUserSupport() {
32                super();
33        }
34 
35        public ExecutionContextUserSupport(String name) {
36                super();
37                this.name = name;
38        }
39 
40        /**
41         * @return name used to uniquely identify this instance's entries in shared context.
42         */
43        protected String getName() {
44                return this.name;
45        }
46 
47        /**
48         * @param name unique name used to create execution context keys.
49         */
50        public void setName(String name) {
51                this.name = name;
52        }
53 
54        /**
55         * Prefix the argument with {@link #getName()} to create a unique key that can be safely used to identify data
56         * stored in {@link ExecutionContext}.
57         */
58        public String getKey(String s) {
59                Assert.hasText(name, "Name must be assigned for the sake of defining the execution context keys prefix.");
60                return name + "." + s;
61        }
62 
63}

[all classes][org.springframework.batch.item.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov