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

COVERAGE SUMMARY FOR SOURCE FILE [CompletionPolicySupport.java]

nameclass, %method, %block, %line, %
CompletionPolicySupport.java100% (1/1)100% (5/5)100% (28/28)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompletionPolicySupport100% (1/1)100% (5/5)100% (28/28)100% (9/9)
CompletionPolicySupport (): void 100% (1/1)100% (3/3)100% (1/1)
isComplete (RepeatContext): boolean 100% (1/1)100% (2/2)100% (1/1)
isComplete (RepeatContext, RepeatStatus): boolean 100% (1/1)100% (11/11)100% (3/3)
start (RepeatContext): RepeatContext 100% (1/1)100% (5/5)100% (1/1)
update (RepeatContext): void 100% (1/1)100% (7/7)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.repeat.policy;
18 
19import org.springframework.batch.repeat.CompletionPolicy;
20import org.springframework.batch.repeat.RepeatStatus;
21import org.springframework.batch.repeat.RepeatContext;
22import org.springframework.batch.repeat.context.RepeatContextSupport;
23 
24/**
25 * Very simple base class for {@link CompletionPolicy} implementations.
26 * 
27 * @author Dave Syer
28 * 
29 */
30public class CompletionPolicySupport implements CompletionPolicy {
31 
32        /**
33         * If exit status is not continuable return <code>true</code>, otherwise
34         * delegate to {@link #isComplete(RepeatContext)}.
35         * 
36         * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext,
37         * RepeatStatus)
38         */
39    @Override
40        public boolean isComplete(RepeatContext context, RepeatStatus result) {
41                if (result != null && !result.isContinuable()) {
42                        return true;
43                }
44                else {
45                        return isComplete(context);
46                }
47        }
48 
49        /**
50         * Always true.
51         * 
52         * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext)
53         */
54    @Override
55        public boolean isComplete(RepeatContext context) {
56                return true;
57        }
58 
59        /**
60         * Build a new {@link RepeatContextSupport} and return it.
61         * 
62         * @see org.springframework.batch.repeat.CompletionPolicy#start(RepeatContext)
63         */
64    @Override
65        public RepeatContext start(RepeatContext context) {
66                return new RepeatContextSupport(context);
67        }
68 
69        /**
70         * Increment the context so the counter is up to date. Do nothing else.
71         * 
72         * @see org.springframework.batch.repeat.CompletionPolicy#update(org.springframework.batch.repeat.RepeatContext)
73         */
74    @Override
75        public void update(RepeatContext context) {
76                if (context instanceof RepeatContextSupport) {
77                        ((RepeatContextSupport) context).increment();
78                }
79        }
80 
81}

[all classes][org.springframework.batch.repeat.policy]
EMMA 2.0.5312 (C) Vladimir Roubtsov