|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.converter.ConverterUtil
public class ConverterUtil
Une classe contenant des méthodes utiles sur les converters et les conversions
org.nuiton.util.ConverterUtil).| Field Summary | |
|---|---|
protected static String |
CONVERTER_PACKAGE
le paquetage où chercher les implentations de Converter, si non présents dans le système |
protected static Boolean |
WAS_INIT
un drapeau pour savoir si on doit charger les converters specifiques |
| Constructor Summary | |
|---|---|
ConverterUtil()
|
|
| Method Summary | ||
|---|---|---|
static byte[] |
convert(char[] chars)
|
|
static
|
convert(Class<T> type,
Object toConvert)
Convertir une valeur! |
|
static void |
deregister()
|
|
static
|
getConverter(Class<T> type)
Cherche un converter pour un type donné. |
|
static void |
initConverters()
|
|
static void |
registerConverter(Class<?> type)
|
|
protected static void |
registerConverter0(Class<?> type)
|
|
static void |
registerEnumConverter(Class<?> type)
Enregistre un nouveau converter pour un type d'enum donné, sans utiliser de valeur par defaut. |
|
static void |
registerEnumConverter(Class<?> type,
Object defaultValue)
Enregistre un nouveau converter pour un type d'enum donné, avec une valeur par defaut. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String CONVERTER_PACKAGE
protected static Boolean WAS_INIT
| Constructor Detail |
|---|
public ConverterUtil()
| Method Detail |
|---|
public static <T> org.apache.commons.beanutils.Converter getConverter(Class<T> type)
type donné.
Recherche dans un premier temps dans les converteurs déjà connus.
Si le type est une énum et qu'aucun converter, n'a été trouvé, on
enregistre un nouveau convert d'enum.
Sinon on tente d'instancier un converteur dans le paquetage dédié aux
converteurs CONVERTER_PACKAGE.
T - le type a convertirtype - le type a convertir
public static <T> T convert(Class<T> type,
Object toConvert)
T - le type de donnee rechercheetype - le type de donnee rechercheetoConvert - l'object a convertir
public static void registerConverter(Class<?> type)
throws IllegalAccessException,
InstantiationException,
ClassNotFoundException
IllegalAccessException
InstantiationException
ClassNotFoundException
protected static void registerConverter0(Class<?> type)
throws IllegalAccessException,
InstantiationException,
ClassNotFoundException
IllegalAccessException
InstantiationException
ClassNotFoundException
public static void registerEnumConverter(Class<?> type,
Object defaultValue)
type - le type d'enum à convertirdefaultValue - la valeur par defaut.public static void registerEnumConverter(Class<?> type)
type - le type d'enum à convertirpublic static byte[] convert(char[] chars)
public static void deregister()
public static void initConverters()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||