EMMA Coverage Report (generated Fri Aug 21 15:59:46 BST 2009)
[all classes][org.springframework.batch.core.listener]

COVERAGE SUMMARY FOR SOURCE FILE [JobListenerMetaData.java]

nameclass, %method, %block, %line, %
JobListenerMetaData.java100% (1/1)90%  (9/10)96%  (109/114)99%  (17.8/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JobListenerMetaData100% (1/1)90%  (9/10)96%  (109/114)99%  (17.8/18)
valueOf (String): JobListenerMetaData 0%   (0/1)0%   (0/5)0%   (0/1)
<static initializer> 100% (1/1)100% (56/56)100% (6/6)
JobListenerMetaData (String, int, String, String, Class): void 100% (1/1)100% (14/14)100% (5/5)
fromPropertyName (String): JobListenerMetaData 100% (1/1)100% (5/5)100% (1/1)
getAnnotation (): Class 100% (1/1)100% (3/3)100% (1/1)
getListenerInterface (): Class 100% (1/1)100% (2/2)100% (1/1)
getMethodName (): String 100% (1/1)100% (3/3)100% (1/1)
getParamTypes (): Class [] 100% (1/1)100% (7/7)100% (1/1)
getPropertyName (): String 100% (1/1)100% (3/3)100% (1/1)
values (): JobListenerMetaData [] 100% (1/1)100% (16/16)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 java.lang.annotation.Annotation;
19import java.util.HashMap;
20import java.util.Map;
21 
22import org.springframework.batch.core.JobExecution;
23import org.springframework.batch.core.JobExecutionListener;
24import org.springframework.batch.core.annotation.AfterJob;
25import org.springframework.batch.core.annotation.BeforeJob;
26 
27/**
28 * Enumeration for {@link JobExecutionListener} meta data, which ties together the names
29 * of methods, their interfaces, annotation, and expected arguments.
30 * 
31 * @author Lucas Ward
32 * @since 2.0
33 * @see JobListenerFactoryBean
34 */
35public enum JobListenerMetaData implements ListenerMetaData {
36 
37        BEFORE_JOB("beforeJob", "before-job-method", BeforeJob.class),
38        AFTER_JOB("afterJob", "after-job-method", AfterJob.class);
39        
40        
41        private final String methodName;
42        private final String propertyName;
43        private final Class<? extends Annotation> annotation;
44        private static final Map<String, JobListenerMetaData> propertyMap;
45        
46        JobListenerMetaData(String methodName, String propertyName, Class<? extends Annotation> annotation) {
47                this.methodName = methodName;
48                this.propertyName = propertyName;
49                this.annotation = annotation;
50        }
51        
52        static{
53                propertyMap = new HashMap<String, JobListenerMetaData>();
54                for(JobListenerMetaData metaData : values()){
55                        propertyMap.put(metaData.getPropertyName(), metaData);
56                }
57        }
58 
59        public String getMethodName() {
60                return methodName;
61        }
62 
63        public Class<? extends Annotation> getAnnotation() {
64                return annotation;
65        }
66 
67        public Class<?> getListenerInterface() {
68                return JobExecutionListener.class;
69        }
70        
71        public String getPropertyName() {
72                return propertyName;
73        }
74        
75        public Class<?>[] getParamTypes() {
76                return new Class<?>[]{ JobExecution.class };
77        }
78 
79        /**
80         * Return the relevant meta data for the provided property name.
81         * 
82         * @param propertyName
83         * @return meta data with supplied property name, null if none exists.
84         */
85        public static JobListenerMetaData fromPropertyName(String propertyName){
86                return propertyMap.get(propertyName);
87        }
88}

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