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

COVERAGE SUMMARY FOR SOURCE FILE [StepListenerFactoryBean.java]

nameclass, %method, %block, %line, %
StepListenerFactoryBean.java100% (1/1)100% (7/7)100% (28/28)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StepListenerFactoryBean100% (1/1)100% (7/7)100% (28/28)100% (9/9)
StepListenerFactoryBean (): void 100% (1/1)100% (3/3)100% (1/1)
getDefaultListenerClass (): Class 100% (1/1)100% (2/2)100% (1/1)
getListener (Object): StepListener 100% (1/1)100% (11/11)100% (3/3)
getMetaDataFromPropertyName (String): ListenerMetaData 100% (1/1)100% (3/3)100% (1/1)
getMetaDataValues (): ListenerMetaData [] 100% (1/1)100% (2/2)100% (1/1)
getObjectType (): Class 100% (1/1)100% (2/2)100% (1/1)
isListener (Object): boolean 100% (1/1)100% (5/5)100% (1/1)

1/*
2 * Copyright 2002-2013 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.listener;
17 
18import org.springframework.batch.core.StepListener;
19 
20/**
21 * This {@link AbstractListenerFactoryBean} implementation is used to create a
22 * {@link StepListener}.
23 *
24 * @author Lucas Ward
25 * @author Dan Garrette
26 * @since 2.0
27 * @see AbstractListenerFactoryBean
28 * @see StepListenerMetaData
29 */
30public class StepListenerFactoryBean extends AbstractListenerFactoryBean {
31 
32        @Override
33        protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) {
34                return StepListenerMetaData.fromPropertyName(propertyName);
35        }
36 
37        @Override
38        protected ListenerMetaData[] getMetaDataValues() {
39                return StepListenerMetaData.values();
40        }
41 
42        @Override
43        protected Class<?> getDefaultListenerClass() {
44                return StepListener.class;
45        }
46 
47        @Override
48        @SuppressWarnings("rawtypes")
49        public Class getObjectType() {
50                return StepListener.class;
51        }
52 
53        /**
54         * Convenience method to wrap any object and expose the appropriate
55         * {@link StepListener} interfaces.
56         *
57         * @param delegate a delegate object
58         * @return a StepListener instance constructed from the delegate
59         */
60        public static StepListener getListener(Object delegate) {
61                StepListenerFactoryBean factory = new StepListenerFactoryBean();
62                factory.setDelegate(delegate);
63                return (StepListener) factory.getObject();
64        }
65 
66        /**
67         * Convenience method to check whether the given object is or can be made
68         * into a {@link StepListener}.
69         *
70         * @param delegate the object to check
71         * @return true if the delegate is an instance of any of the
72         *         {@link StepListener} interfaces, or contains the marker
73         *         annotations
74         */
75        public static boolean isListener(Object delegate) {
76                return AbstractListenerFactoryBean.isListener(delegate, StepListener.class, StepListenerMetaData.values());
77        }
78}

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