| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| Converter | 49 | 0 | - | 0 | 0 |
| 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.properties.converter; | |
| 21 | ||
| 22 | import java.lang.reflect.Type; | |
| 23 | ||
| 24 | import org.xwiki.component.annotation.Role; | |
| 25 | ||
| 26 | /** | |
| 27 | * Converter provided value in the provided target type. | |
| 28 | * <p> | |
| 29 | * The type supported by the converted is indicated in its role. | |
| 30 | * <p> | |
| 31 | * For example: | |
| 32 | * <p> | |
| 33 | * <blockquote> | |
| 34 | * | |
| 35 | * <pre> | |
| 36 | * @Component | |
| 37 | * public class IntegerConverter implements Converter<java.lang.Integer> | |
| 38 | * </pre> | |
| 39 | * | |
| 40 | * </blockquote> | |
| 41 | * <p> | |
| 42 | * When something goes wrong a Converter can throw a {@link ConversionException}. | |
| 43 | * | |
| 44 | * @param <T> the type in which the provided value has to be converted | |
| 45 | * @version $Id: 35eb4dbb0b09a5c0e75886d1dfc983564a2adbea $ | |
| 46 | * @since 2.0M2 | |
| 47 | */ | |
| 48 | @Role | |
| 49 | public interface Converter<T> | |
| 50 | { | |
| 51 | /** | |
| 52 | * @param <G> the type in which the provided value has to be converted | |
| 53 | * @param targetType the type in which the provided value has to be converted | |
| 54 | * @param sourceValue the value to convert | |
| 55 | * @return the converted value | |
| 56 | * @since 3.0M1 | |
| 57 | */ | |
| 58 | <G> G convert(Type targetType, Object sourceValue); | |
| 59 | } |