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 [CallableTaskletAdapter.java]

nameclass, %method, %block, %line, %
CallableTaskletAdapter.java100% (1/1)75%  (3/4)75%  (12/16)67%  (4/6)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CallableTaskletAdapter100% (1/1)75%  (3/4)75%  (12/16)67%  (4/6)
afterPropertiesSet (): void 0%   (0/1)0%   (0/4)0%   (0/2)
CallableTaskletAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
execute (StepContribution, ChunkContext): RepeatStatus 100% (1/1)100% (5/5)100% (1/1)
setCallable (Callable): 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.core.step.tasklet;
17 
18import java.util.concurrent.Callable;
19 
20import org.springframework.batch.core.StepContribution;
21import org.springframework.batch.core.scope.context.ChunkContext;
22import org.springframework.batch.repeat.RepeatStatus;
23import org.springframework.beans.factory.InitializingBean;
24import org.springframework.util.Assert;
25 
26/**
27 * Adapts a {@link Callable}<{@link RepeatStatus}> to the {@link Tasklet}
28 * interface.
29 * 
30 * @author Dave Syer
31 * 
32 */
33public class CallableTaskletAdapter implements Tasklet, InitializingBean {
34 
35        private Callable<RepeatStatus> callable;
36 
37        /**
38         * Public setter for the {@link Callable}.
39         * @param callable the {@link Callable} to set
40         */
41        public void setCallable(Callable<RepeatStatus> callable) {
42                this.callable = callable;
43        }
44 
45        /**
46         * Assert that the callable is set.
47         * 
48         * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
49         */
50        public void afterPropertiesSet() throws Exception {
51                Assert.notNull(callable);
52        }
53 
54        /**
55         * Execute the provided Callable and return its {@link RepeatStatus}. Ignores
56         * the {@link StepContribution} and the attributes.
57         * @see Tasklet#execute(StepContribution, ChunkContext)
58         */
59        public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
60                return callable.call();
61        }
62 
63}

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