Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../img/srcFileCovDistChart7.png 76% of files have more coverage
5   66   3   2.5
2   30   0.6   2
2     1.5  
1    
 
  ResourceReferenceConverter       Line # 42 5 0% 3 3 66.7% 0.6666667
 
  (3)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.internal.macro;
21   
22    import javax.inject.Inject;
23    import javax.inject.Named;
24    import javax.inject.Singleton;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.properties.converter.AbstractConverter;
28    import org.xwiki.properties.converter.ConversionException;
29    import org.xwiki.rendering.parser.ResourceReferenceParser;
30   
31    /**
32    * XWiki Properties Bean Converter to convert Strings into
33    * {@link org.xwiki.rendering.listener.reference.ResourceReference}.
34    *
35    * @version $Id: d58fdfcb891b7b80a810819fb4257042dfb8f16d $
36    * @since 2.6M1
37    * @see org.xwiki.properties.converter.Converter
38    */
39    @Component
40    @Named("org.xwiki.rendering.listener.reference.ResourceReference")
41    @Singleton
 
42    public class ResourceReferenceConverter extends AbstractConverter
43    {
44    /**
45    * Used to convert Resource References from String to ResourceReference object.
46    */
47    @Inject
48    private ResourceReferenceParser referenceParser;
49   
 
50  3 toggle @Override
51    protected <T> T convertToType(Class<T> type, Object value)
52    {
53  3 T reference = null;
54  3 if (value != null) {
55  3 reference = type.cast(this.referenceParser.parse(value.toString()));
56    }
57   
58  3 return reference;
59    }
60   
 
61  0 toggle @Override
62    protected String convertToString(Object value)
63    {
64  0 throw new ConversionException("not implemented yet");
65    }
66    }