EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[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)95%  (97/102)99%  (17.9/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JobListenerMetaData100% (1/1)90%  (9/10)95%  (97/102)99%  (17.9/18)
valueOf (String): JobListenerMetaData 0%   (0/1)0%   (0/5)0%   (0/1)
<static initializer> 100% (1/1)100% (56/56)100% (7/7)
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% (4/4)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 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        @Override
60        public String getMethodName() {
61                return methodName;
62        }
63 
64        @Override
65        public Class<? extends Annotation> getAnnotation() {
66                return annotation;
67        }
68 
69        @Override
70        public Class<?> getListenerInterface() {
71                return JobExecutionListener.class;
72        }
73 
74        @Override
75        public String getPropertyName() {
76                return propertyName;
77        }
78 
79        @Override
80        public Class<?>[] getParamTypes() {
81                return new Class<?>[]{ JobExecution.class };
82        }
83 
84        /**
85         * Return the relevant meta data for the provided property name.
86         *
87         * @param propertyName
88         * @return meta data with supplied property name, null if none exists.
89         */
90        public static JobListenerMetaData fromPropertyName(String propertyName){
91                return propertyMap.get(propertyName);
92        }
93}

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