package be.selckin.swu.convert;
import org.apache.wicket.util.convert.ConversionException;
import org.apache.wicket.util.convert.IConverter;
import java.util.Locale;
public class ClassConverter implements IConverter<Class<?>> {
@Override
public Class<?> convertToObject(String value, Locale locale) {
try {
return Class.forName(value, false, this.getClass().getClassLoader());
} catch (ClassNotFoundException e) {
throw new ConversionException(e);
}
}
@Override
public String convertToString(Class<?> value, Locale locale) {
if (value == null)
return "";
return value.getName();
}
}