Exemple #1
0
 public PropertyConverter getPropertyConverter(Class propertyClass) {
   if (propertyClass == null) {
     throw new IllegalArgumentException();
   }
   for (Iterator it = _converters.values().iterator(); it.hasNext(); ) {
     PropertyConverter propertyConverter = (PropertyConverter) it.next();
     Class converterClass = propertyConverter.getPropetyClass();
     if (propertyClass.isAssignableFrom(converterClass)) {
       return propertyConverter;
     }
   }
   return null;
 }
Exemple #2
0
 public void addPropertyConverter(String name, PropertyConverter propertyConverter) {
   if (propertyConverter == null) {
     throw new IllegalArgumentException();
   }
   if (StringUtil.isEmpty(name)) {
     name = propertyConverter.getPropetyClass().getName();
   }
   if (_converters.containsKey(name)) {
     warnAlreadyRegistered(propertyConverter, name, 1);
   } else {
     _converters.put(name, propertyConverter);
   }
 }