EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[all classes][org.springframework.batch.core.listener]

COVERAGE SUMMARY FOR SOURCE FILE [JobListenerFactoryBean.java]

nameclass, %method, %block, %line, %
JobListenerFactoryBean.java100% (1/1)86%  (6/7)93%  (26/28)89%  (8/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JobListenerFactoryBean100% (1/1)86%  (6/7)93%  (26/28)89%  (8/9)
getDefaultListenerClass (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
JobListenerFactoryBean (): void 100% (1/1)100% (3/3)100% (1/1)
getListener (Object): JobExecutionListener 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-2008 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.JobExecutionListener;
19 
20/**
21 * This {@link AbstractListenerFactoryBean} implementation is used to create a
22 * {@link JobExecutionListener}.
23 * 
24 * @author Lucas Ward
25 * @author Dan Garrette
26 * @since 2.0
27 * @see AbstractListenerFactoryBean
28 * @see JobListenerMetaData
29 */
30public class JobListenerFactoryBean extends AbstractListenerFactoryBean {
31 
32        protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) {
33                return JobListenerMetaData.fromPropertyName(propertyName);
34        }
35 
36        protected ListenerMetaData[] getMetaDataValues() {
37                return JobListenerMetaData.values();
38        }
39 
40        protected Class<?> getDefaultListenerClass() {
41                return JobExecutionListener.class;
42        }
43 
44        public Class<?> getObjectType() {
45                return JobExecutionListener.class;
46        }
47 
48        /**
49         * Convenience method to wrap any object and expose the appropriate
50         * {@link JobExecutionListener} interfaces.
51         * 
52         * @param delegate a delegate object
53         * @return a JobListener instance constructed from the delegate
54         */
55        public static JobExecutionListener getListener(Object delegate) {
56                JobListenerFactoryBean factory = new JobListenerFactoryBean();
57                factory.setDelegate(delegate);
58                return (JobExecutionListener) factory.getObject();
59        }
60 
61        /**
62         * Convenience method to check whether the given object is or can be made
63         * into a {@link JobExecutionListener}.
64         * 
65         * @param delegate the object to check
66         * @return true if the delegate is an instance of
67         *         {@link JobExecutionListener}, or contains the marker annotations
68         */
69        public static boolean isListener(Object delegate) {
70                return AbstractListenerFactoryBean.isListener(delegate, JobExecutionListener.class, JobListenerMetaData
71                                .values());
72        }
73}

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