Clover coverage report - Converter - 1.0
Coverage timestamp: Thu Jan 1 1970 10:00:00 EST
file stats: LOC: 72   Methods: 3
NCLOC: 28   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
StringToFileConverter.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * Copyright (C) The Spice Group. All rights reserved.
 3   
  *
 4   
  * This software is published under the terms of the Spice
 5   
  * Software License version 1.1, a copy of which has been included
 6   
  * with this distribution in the LICENSE.txt file.
 7   
  */
 8   
 package org.codehaus.spice.converter.lib;
 9   
 
 10   
 import java.io.File;
 11   
 import org.codehaus.spice.converter.AbstractConverter;
 12   
 import org.codehaus.spice.converter.ConverterException;
 13   
 
 14   
 /**
 15   
  * String to File converter.
 16   
  *
 17   
  * @author Peter Donald
 18   
  * @version $Revision: 1.1 $ $Date: 2003/12/02 08:37:56 $
 19   
  */
 20   
 public class StringToFileConverter
 21   
     extends AbstractConverter
 22   
 {
 23   
     /**
 24   
      * The directory that relative files are relative to.
 25   
      */
 26   
     private final File m_baseDirectory;
 27   
 
 28   
     /**
 29   
      * Construct the converter.
 30   
      *
 31   
      * @param baseDirectory the directory that relative files are relative to
 32   
      */
 33  0
     public StringToFileConverter( final File baseDirectory )
 34   
     {
 35  0
         this( baseDirectory, null );
 36   
     }
 37   
 
 38   
     /**
 39   
      * Construct the converter with a default value.
 40   
      * If the default value is non-null, it will be returned if unable
 41   
      * to convert object to correct type.
 42   
      *
 43   
      * @param baseDirectory the directory that relative files are relative to
 44   
      * @param defaultValue the default value
 45   
      */
 46  0
     public StringToFileConverter( final File baseDirectory,
 47   
                                   final File defaultValue )
 48   
     {
 49  0
         super( String.class, File.class, defaultValue );
 50  0
         if( null == baseDirectory )
 51   
         {
 52  0
             throw new NullPointerException( "baseDirectory" );
 53   
         }
 54  0
         m_baseDirectory = baseDirectory;
 55   
     }
 56   
 
 57   
     /**
 58   
      * Converts a String to a File.
 59   
      *
 60   
      * @param object the original object to convert
 61   
      * @param context the context in which to convert object (unused)
 62   
      * @return the converted object
 63   
      * @throws ConverterException if error converting object
 64   
      */
 65  0
     public Object convert( final Object object, final Object context )
 66   
         throws ConverterException
 67   
     {
 68  0
         return new File( m_baseDirectory, object.toString() );
 69   
     }
 70   
 }
 71   
 
 72