001    /*****************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the LICENSE.txt file.                                                     *
007     *****************************************************************************/
008    package org.picocontainer;
009    
010    import java.lang.reflect.Type;
011    
012    /**
013     * A facade for a collection of converters that provides string-to-type conversions. 
014     * 
015     * @author Paul Hammant
016     * @author Michael Rimov
017     */
018    public interface Converters {
019        
020        /**
021         * Returns true if a converters is available to convert to the given object type
022         * 
023         * @param type the object Type to convert to
024         * @return true if the type can be converted to
025         */
026        boolean canConvert(Type type);
027        
028        /**
029         * Converts a particular string value into the target type
030         * 
031         * @param value the String value to convert
032         * @param type the object Type to convert to
033         * @return The converted Object instance
034         */
035        Object convert(String value, Type type);
036    }