本文整理汇总了Java中org.apache.wicket.util.convert.ConversionException类的典型用法代码示例。如果您正苦于以下问题:Java ConversionException类的具体用法?Java ConversionException怎么用?Java ConversionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConversionException类属于org.apache.wicket.util.convert包,在下文中一共展示了ConversionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected Serializable convertInputToValue() throws ConversionException {
final Serializable bean = (Serializable) getBeanDescriptor().newBeanInstance();
visitChildren(PropertyEditor.class, new IVisitor<PropertyEditor<Serializable>, PropertyEditor<Serializable>>() {
@Override
public void component(PropertyEditor<Serializable> object, IVisit<PropertyEditor<Serializable>> visit) {
object.getPropertyDescriptor().setPropertyValue(bean, object.getConvertedInput());
visit.dontGoDeeper();
}
});
return bean;
}
示例2: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected List<Serializable> convertInputToValue() throws ConversionException {
if (get("listEditor").isVisible()) {
List<Serializable> newList = newList();
RepeatingView rows = (RepeatingView) get("listEditor").get("elements");
for (Component row: rows) {
Serializable element = newElement();
newList.add(element);
RepeatingView columns = (RepeatingView) row.get("properties");
for (Component column: columns) {
@SuppressWarnings("unchecked")
PropertyEditor<Serializable> propertyEditor = (PropertyEditor<Serializable>) column.get("propertyEditor");
propertyEditor.getPropertyDescriptor().setPropertyValue(element, propertyEditor.getConvertedInput());
}
}
return newList;
} else {
return null;
}
}
示例3: getConvertedValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
public String getConvertedValue(String fieldValue, Locale locale) throws ConversionException {
final LanguageInfo languageInfo = languageCodeUtils.decodeLanguageCodeString(fieldValue);
if (languageInfo == null) {
return null;
} else {
switch (languageInfo.getType()) {
case CODE:
return languageCodeUtils.getLanguageNameForLanguageCode(languageInfo.getValue());
case NAME:
return languageInfo.getValue();
default:
return null;
}
}
}
示例4: convertToObject
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
public Map<String, String> convertToObject(String s, Locale locale) throws ConversionException {
if (null == s) {
return null;
}
Map<String, String> map = new HashMap<>();
String[] kvList = s.trim().split(ListConverter.LIST_SPLIT_PATTERN);
for (String kvString : kvList) {
String[] kv = kvString.split(KEY_VALUE_SPLIT_PATTERN);
if (2 == kv.length) {
map.put(kv[0], kv[1]);
} else if (1 != kv.length || !kv[0].isEmpty()) { // skip ;;
throw new ConversionException("'" + kvString + "' is not a valid Map entry.");
}
}
return map;
}
示例5: convertValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected List<F> convertValue(String[] values) throws ConversionException {
if (values == null) {
return Lists.newArrayList();
} else {
List<F> convertedValues = Lists.newArrayList();
for (String value : values) {
try {
J convertedValue = OBJECT_MAPPER.readValue(value, getJsonType());
convertedValues.add(convertValue(convertedValue));
} catch (Exception e) {
throw new ConversionException(e);
}
}
return convertedValues;
}
}
示例6: convertToObject
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
public CustomerProjectPartDto convertToObject(String value, Locale locale) throws ConversionException {
if (value == null) {
return null;
}
List<CustomerProjectPartDto> list = projects.getObject();
for (CustomerProjectPartDto dto : list) {
if (value.equals(convertToString(dto, locale))) {
return dto;
}
}
throw new ConversionException("DashboardProjectConverter.cantConvert").setSourceValue(value)
.setTargetType(CustomerProjectPartDto.class)
.setConverter(this)
.setLocale(locale);
}
示例7: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected List<String> convertInputToValue() throws ConversionException {
List<String> userNames = new ArrayList<>();
Collection<UserFacade> users = input.getConvertedInput();
if (users != null) {
for (UserFacade user: users)
userNames.add(user.getName());
}
return userNames;
}
示例8: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected String convertInputToValue() throws ConversionException {
UserFacade user = input.getConvertedInput();
if (user != null)
return user.getName();
else
return null;
}
示例9: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected Boolean convertInputToValue() throws ConversionException {
String stringValue = input.getConvertedInput();
if ("yes".equals(stringValue))
return true;
else if ("no".equals(stringValue))
return false;
else
return null;
}
示例10: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Serializable convertInputToValue() throws ConversionException {
Component beanEditor = get(BEAN_EDITOR_ID);
if (beanEditor.isVisible())
return ((BeanEditor<Serializable>) beanEditor).getConvertedInput();
else
return null;
}
示例11: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected List<String> convertInputToValue() throws ConversionException {
List<String> values = new ArrayList<>();
for (String each: input.getConvertedInput())
values.add(each);
return values;
}
示例12: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected List<Serializable> convertInputToValue() throws ConversionException {
if (get("listEditor").isVisible()) {
List<Serializable> newList = newList();
RepeatingView rows = (RepeatingView) get("listEditor").get("elements");
for (Component row: rows) {
@SuppressWarnings("unchecked")
BeanEditor<Serializable> elementEditor = (BeanEditor<Serializable>) row.get("elementEditor");
newList.add(elementEditor.getConvertedInput());
}
return newList;
} else {
return null;
}
}
示例13: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected List<Enum<?>> convertInputToValue() throws ConversionException {
List<Enum<?>> values = new ArrayList<>();
for (String stringValue: input.getConvertedInput()) {
for (Iterator<?> it = EnumSet.allOf(enumClass).iterator(); it.hasNext();) {
Enum<?> value = (Enum<?>) it.next();
if (value.toString().equals(stringValue)) {
values.add(value);
break;
}
}
}
return values;
}
示例14: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Serializable convertInputToValue() throws ConversionException {
Component beanEditor = fragment.get(BEAN_EDITOR_ID);
if (beanEditor instanceof BeanEditor) {
return ((BeanEditor<Serializable>) beanEditor).getConvertedInput();
} else {
return null;
}
}
示例15: convertInputToValue
import org.apache.wicket.util.convert.ConversionException; //导入依赖的package包/类
@Override
protected String convertInputToValue() throws ConversionException {
if (input.getConvertedInput() != null) {
if (inputAgain.getConvertedInput() == null)
throw new ConversionException("Please confirm the password.");
else if (!input.getConvertedInput().equals(inputAgain.getConvertedInput()))
throw new ConversionException("Password and its confirmation should be identical.");
else
return input.getConvertedInput();
} else if (inputAgain.getConvertedInput() != null) {
throw new ConversionException("Password and its confirmation should be identical.");
} else {
return input.getConvertedInput();
}
}