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

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