EMMA Coverage Report (generated Fri Jan 30 13:20:29 EST 2009)
[all classes][org.springframework.batch.item.support]

COVERAGE SUMMARY FOR SOURCE FILE [DelegatingItemReader.java]

nameclass, %method, %block, %line, %
DelegatingItemReader.java100% (1/1)57%  (4/7)53%  (16/30)50%  (7/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DelegatingItemReader100% (1/1)57%  (4/7)53%  (16/30)50%  (7/14)
DelegatingItemReader (ItemReader): void 0%   (0/1)0%   (0/6)0%   (0/3)
mark (): void 0%   (0/1)0%   (0/4)0%   (0/2)
reset (): void 0%   (0/1)0%   (0/4)0%   (0/2)
DelegatingItemReader (): void 100% (1/1)100% (3/3)100% (2/2)
afterPropertiesSet (): void 100% (1/1)100% (5/5)100% (2/2)
read (): Object 100% (1/1)100% (4/4)100% (1/1)
setItemReader (ItemReader): 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 */
16 
17package org.springframework.batch.item.support;
18 
19import org.springframework.batch.item.ItemReader;
20import org.springframework.beans.factory.InitializingBean;
21import org.springframework.util.Assert;
22 
23/**
24 * Simple wrapper around {@link ItemReader}. The item reader is expected to
25 * take care of open and close operations. If necessary it should be registered
26 * as a step scoped bean to ensure that the lifecycle methods are called.
27 * 
28 * The implementation is thread-safe if the delegate is thread-safe.
29 * 
30 * @author Dave Syer
31 */
32public class DelegatingItemReader extends AbstractItemReader implements InitializingBean {
33 
34        private ItemReader itemReader;
35        
36        /**
37         * Default constructor.
38         */
39        public DelegatingItemReader() {
40                super();
41        }
42 
43        /**
44         * Convenience constructor for setting mandatory property.
45         */
46        public DelegatingItemReader(ItemReader itemReader) {
47                this();
48                this.itemReader = itemReader;
49        }
50 
51        public void afterPropertiesSet() throws Exception {
52                Assert.notNull(itemReader, "ItemReader must not be null.");
53        }
54 
55        /**
56         * Get the next object from the input source.
57         * @throws Exception
58         * @see org.springframework.batch.item.ItemReader#read()
59         */
60        public Object read() throws Exception {
61                return itemReader.read();
62        }
63 
64        /**
65         * Setter for input source.
66         * @param source
67         */
68        public void setItemReader(ItemReader source) {
69                this.itemReader = source;
70        }
71        
72        /*
73         * (non-Javadoc)
74         * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
75         */
76        public void mark() {
77                itemReader.mark();
78        }
79 
80        /*
81         * (non-Javadoc)
82         * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
83         */
84        public void reset() {
85                itemReader.reset();
86        }
87}

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