EMMA Coverage Report (generated Tue Feb 12 22:23:49 ICT 2008)
[all classes][net.sourceforge.hiveutils.service.impl]

COVERAGE SUMMARY FOR SOURCE FILE [DefaultMethodMappingErrorHandler.java]

nameclass, %method, %block, %line, %
DefaultMethodMappingErrorHandler.java100% (1/1)33%  (1/3)8%   (6/77)33%  (3/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultMethodMappingErrorHandler100% (1/1)33%  (1/3)8%   (6/77)33%  (3/9)
handleIncompatibleMethods (Method, Method): boolean 0%   (0/1)0%   (0/47)0%   (0/4)
handleNonExistingMethod (Method, Class): void 0%   (0/1)0%   (0/24)0%   (0/2)
DefaultMethodMappingErrorHandler (Log): void 100% (1/1)100% (6/6)100% (3/3)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveutils.service.impl;
16 
17import java.lang.reflect.Method;
18 
19import org.apache.commons.logging.Log;
20 
21import net.sourceforge.hiveutils.util.MethodMappingErrorHandler;
22 
23/**
24 * Default implmentation of <code>MethodMappingErrorHandler</code>, used by
25 * <code>AdapterBuilderFactory</code> to log warnings.
26 *
27 * @author Jean-Francois Poilpret
28 */
29public class DefaultMethodMappingErrorHandler implements MethodMappingErrorHandler
30{
31        public DefaultMethodMappingErrorHandler(Log logger)
32        {
33                _logger = logger;
34        }
35        
36        public boolean        handleIncompatibleMethods(Method source, Method target)
37        {
38                Class srcReturn = source.getReturnType();
39                Class tgtReturn = target.getReturnType();
40                _logger.warn(        srcReturn.getName() + " " + source.getClass().getName() +
41                                                "." + source.getName() + 
42                                                "() return type is not assignable from " +
43                                                tgtReturn.getName() + " " + target.getClass().getName() +
44                                                "." + target.getName() + "()");
45                return true;
46        }
47 
48        public void                handleNonExistingMethod(Method source, Class target)
49        {
50                _logger.error(        target.getName() + " class does not implement method " + 
51                                                source.getName() + " of " +
52                                                source.getClass().getName() + 
53                                                " service interface");
54        }
55        
56        private final Log        _logger;
57}

[all classes][net.sourceforge.hiveutils.service.impl]
EMMA 2.0.5312 (C) Vladimir Roubtsov