Clover coverage report - [ini4j]
Coverage timestamp: Sze nov. 30 2005 08:31:05 CET
file stats: LOC: 46   Methods: 4
NCLOC: 27   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PreferencesBean.java - 100% 100% 100%
coverage
 1    /*
 2    * Copyright 2005 [ini4j] Development Team
 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    */
 16    package org.ini4j;
 17   
 18    import java.beans.*;
 19    import java.lang.reflect.*;
 20    import java.util.prefs.*;
 21    import java.util.*;
 22   
 23    public class PreferencesBean
 24    {
 25  1 public static <T> T newInstance(Class<T> clazz, final Preferences prefs)
 26    {
 27  1 return clazz.cast(Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] {clazz}, new AbstractBeanInvocationHandler()
 28    {
 29  1 protected Object getPropertySpi(String property, Class<?> clazz)
 30    {
 31  1 return prefs.get(property,null);
 32    }
 33   
 34  1 protected void setPropertySpi(String property, Object value, Class<?> clazz)
 35    {
 36  1 prefs.put(property, value.toString());
 37    }
 38   
 39  2 protected boolean hasPropertySpi(String property)
 40    {
 41  2 return prefs.get(property, null) != null;
 42    }
 43    }
 44    ));
 45    }
 46    }