本文整理汇总了Java中com.thoughtworks.xstream.converters.UnmarshallingContext.currentObject方法的典型用法代码示例。如果您正苦于以下问题:Java UnmarshallingContext.currentObject方法的具体用法?Java UnmarshallingContext.currentObject怎么用?Java UnmarshallingContext.currentObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.xstream.converters.UnmarshallingContext
的用法示例。
在下文中一共展示了UnmarshallingContext.currentObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmarshal
import com.thoughtworks.xstream.converters.UnmarshallingContext; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Object object = context.currentObject();
if( object == null )
{
object = createDefaultInstance(context.getRequiredType());
}
XMLDataMappings mappings;
synchronized( XMLDataConverter.class )
{
mappings = ((XMLData) object).getMappings();
}
recurseUnmarshal(object, reader, context, "", mappings);
return object;
}
示例2: instantiateNewInstance
import com.thoughtworks.xstream.converters.UnmarshallingContext; //导入方法依赖的package包/类
protected Object instantiateNewInstance(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
final String attributeName = mapper.aliasForSystemAttribute("resolves-to");
final String readResolveValue = attributeName == null ? null : reader.getAttribute(attributeName);
final Object currentObject = context.currentObject();
if (currentObject != null) {
return currentObject;
} else if (readResolveValue != null) {
return reflectionProvider.newInstance(mapper.realClass(readResolveValue));
} else {
return reflectionProvider.newInstance(context.getRequiredType());
}
}
示例3: instantiateNewInstance
import com.thoughtworks.xstream.converters.UnmarshallingContext; //导入方法依赖的package包/类
private Object instantiateNewInstance(final UnmarshallingContext context) {
Object result = context.currentObject();
if (result == null) {
result = beanProvider.newInstance(context.getRequiredType());
}
return result;
}