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

COVERAGE SUMMARY FOR SOURCE FILE [PreferencesObjectProvider.java]

nameclass, %method, %block, %line, %
PreferencesObjectProvider.java100% (1/1)100% (2/2)88%  (14/16)83%  (5/6)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PreferencesObjectProvider100% (1/1)100% (2/2)88%  (14/16)83%  (5/6)
provideObject (Module, Class, String, Location): Object 100% (1/1)80%  (8/10)67%  (2/3)
PreferencesObjectProvider (PreferencesManager): 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 org.apache.hivemind.HiveMind;
18import org.apache.hivemind.Location;
19import org.apache.hivemind.internal.Module;
20import org.apache.hivemind.service.ObjectProvider;
21 
22import net.sourceforge.hiveutils.service.PreferencesManager;
23 
24/**
25 * An <code>org.apache.hivemind.service.ObjectProvider</code>
26 * that returns a preference object by its name, that object is provided by
27 * <code>net.sourceforge.hiveutils.service.PreferencesManager</code>.  The
28 * translator string is of the form: <code>name</code>. That is, the name of
29 * the preference definition in <code>Preferences</code> configuration point.
30 *
31 * @author Jean-Francois Poilpret
32 */
33public class PreferencesObjectProvider implements ObjectProvider
34{
35        public PreferencesObjectProvider(PreferencesManager manager)
36        {
37                _manager = manager;
38        }
39        
40        public Object provideObject(Module                contributingModule,
41                                                                Class                propertyType,
42                                                                String                inputValue,
43                                                                Location        location)
44        {
45                if (HiveMind.isBlank(inputValue))
46                {
47                        return null;
48                }
49 
50                return         _manager.read(inputValue);
51        }
52 
53        private final PreferencesManager        _manager;
54}

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