本文整理汇总了Java中javax.xml.bind.annotation.adapters.NormalizedStringAdapter.unmarshal方法的典型用法代码示例。如果您正苦于以下问题:Java NormalizedStringAdapter.unmarshal方法的具体用法?Java NormalizedStringAdapter.unmarshal怎么用?Java NormalizedStringAdapter.unmarshal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.annotation.adapters.NormalizedStringAdapter
的用法示例。
在下文中一共展示了NormalizedStringAdapter.unmarshal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmarshal
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; //导入方法依赖的package包/类
/**
* @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
*/
@Override
public Map<String, String> unmarshal(QualificationList v) throws Exception {
if (v != null) {
NormalizedStringAdapter normalizedStringAdapter = new NormalizedStringAdapter();
Map<String, String> map = new HashMap<String, String>();
for (MapStringStringAdapter.StringMapEntry stringMapEntry : v.getQualifications()) {
String tempKey = normalizedStringAdapter.unmarshal(stringMapEntry.getKey());
if (StringUtils.isBlank(tempKey)) {
throw new UnmarshalException("Cannot create a qualification entry with a blank key");
} else if (map.containsKey(tempKey)) {
throw new UnmarshalException("Cannot create more than one qualification entry with a key of \"" + tempKey + "\"");
}
map.put(tempKey, normalizedStringAdapter.unmarshal(stringMapEntry.getValue()));
}
}
return null;
}
示例2: unmarshal
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; //导入方法依赖的package包/类
/**
* @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
*/
@Override
public Map<String, String> unmarshal(PermissionDetailList v) throws Exception {
if (v != null) {
NormalizedStringAdapter normalizedStringAdapter = new NormalizedStringAdapter();
Map<String, String> map = new HashMap<String, String>();
for (MapStringStringAdapter.StringMapEntry stringMapEntry : v.getPermissionDetails()) {
String tempKey = normalizedStringAdapter.unmarshal(stringMapEntry.getKey());
if (StringUtils.isBlank(tempKey)) {
throw new UnmarshalException("Cannot create a permission detail entry with a blank key");
} else if (map.containsKey(tempKey)) {
throw new UnmarshalException("Cannot create more than one permission detail entry with a key of \"" + tempKey + "\"");
}
map.put(tempKey, normalizedStringAdapter.unmarshal(stringMapEntry.getValue()));
}
}
return null;
}