本文整理汇总了Java中com.thoughtworks.xstream.io.HierarchicalStreamReader类的典型用法代码示例。如果您正苦于以下问题:Java HierarchicalStreamReader类的具体用法?Java HierarchicalStreamReader怎么用?Java HierarchicalStreamReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HierarchicalStreamReader类属于com.thoughtworks.xstream.io包,在下文中一共展示了HierarchicalStreamReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
/**
* reads a <code>Expression</code> from the XML file specified through
* <code>reader</code>
*
* @pre <code>reader</code> leads to a valid <code>Expression</code>
* @post the <code>Expression</code> is read from the XML file and returned
* @param reader stream to read through
* @param context <code>UnmarshallingContext</code> used to store generic
* data
* @return <code>Expression</code> - <code>Expression</code> read from file
* specified by <code>reader</code>
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
Expression expression = new Expression();
reader.moveDown();
expression.setName(reader.getValue());
reader.moveUp();
reader.moveDown();
expression.setExcelExpressionString(reader.getValue());
reader.moveUp();
reader.moveDown();
ExpressionTreeInterface expressionTree = new ExpressionTree();
expressionTree = (ExpressionTreeInterface) context.convertAnother(expressionTree, ExpressionTree.class);
expression.setExpressionTree(expressionTree);
reader.moveUp();
return expression;
}
示例2: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
/**
* reads a <code>shrimpSpeciesNode</code> from the XML file specified
* through <code>reader</code>
*
* @pre <code>reader</code> leads to a valid <code>ShrimpSpeciesNode</code>
* @post the <code>ShrimpSpeciesNode</code> is read from the XML file and
* returned
* @param reader stream to read through
* @param context <code>UnmarshallingContext</code> used to store generic
* data
* @return <code>ShrimpSpeciesNode</code> - <code>ShrimpSpeciesNode</code>
* read from file specified by <code>reader</code>
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
ShrimpSpeciesNode shrimpSpeciesNode = ShrimpSpeciesNode.buildEmptyShrimpSpeciesNode();
reader.moveDown();
shrimpSpeciesNode.setName(reader.getValue());
reader.moveUp();
reader.moveDown();
SquidSpeciesModel squidSpeciesModel = new SquidSpeciesModel();
squidSpeciesModel = (SquidSpeciesModel) context.convertAnother(squidSpeciesModel, SquidSpeciesModel.class);
shrimpSpeciesNode.setsquidSpeciesModel(squidSpeciesModel);
reader.moveUp();
reader.moveDown();
shrimpSpeciesNode.setMethodNameForShrimpFraction(reader.getValue());
reader.moveUp();
return shrimpSpeciesNode;
}
示例3: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
/**
* reads a <code>spotFieldNode</code> from the XML file specified
* through <code>reader</code>
*
* @pre <code>reader</code> leads to a valid <code>spotFieldNode</code>
* @post the <code>spotFieldNode</code> is read from the XML file and
* returned
* @param reader stream to read through
* @param context <code>UnmarshallingContext</code> used to store generic
* data
* @return <code>spotFieldNode</code> - <code>spotFieldNode</code>
* read from file specified by <code>reader</code>
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
SpotFieldNode spotFieldNode = new SpotFieldNode();
reader.moveDown();
spotFieldNode.setName(reader.getValue());
reader.moveUp();
reader.moveDown();
spotFieldNode.setMethodNameForShrimpFraction(reader.getValue());
reader.moveUp();
return spotFieldNode;
}
示例4: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
/**
* reads a <code>VariableNodeForSummary</code> from the XML file specified through
* <code>reader</code>
*
* @pre <code>reader</code> leads to a valid <code>Operation</code>
* @post the <code>VariableNodeForSummary</code> is read from the XML file and returned
* @param reader stream to read through
* @param context <code>UnmarshallingContext</code> used to store generic
* data
* @return <code>VariableNodeForSummary</code> - <code>VariableNodeForSummary</code> read from file
* specified by <code>reader</code>
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
ExpressionTreeInterface variable = null;
String variableType = reader.getNodeName();
reader.moveDown();
String variableName = reader.getValue();
reader.moveUp();
switch (variableType) {
case "VariableNodeForSummary":
variable = new VariableNodeForSummary(variableName);
break;
case "VariableNodeForPerSpotTaskExpressions":
variable = new VariableNodeForPerSpotTaskExpressions(variableName);
break;
case "VariableNodeForIsotopicRatios":
variable = new VariableNodeForIsotopicRatios(variableName);
break;
}
return variable;
}
示例5: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
/**
* reads a <code>Task</code> from the XML file specified through
* <code>reader</code>
*
* @pre <code>reader</code> leads to a valid <code>Task</code>
* @post the <code>Task</code> is read from the XML file and returned
* @param reader stream to read through
* @param context <code>UnmarshallingContext</code> used to store generic
* data
* @return <code>Task</code> - <code>Task</code> read from file specified by
* <code>reader</code>
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
TaskInterface task = new Task();
reader.moveDown();
task.setName(reader.getValue());
reader.moveUp();
SortedSet<ExpressionTree> taskExpressions = new TreeSet<>();
reader.moveDown();
while (reader.hasMoreChildren()) {
reader.moveDown();
ExpressionTreeInterface exp = new ExpressionTree();
exp = (ExpressionTreeInterface) context.convertAnother(exp, ExpressionTree.class);
taskExpressions.add((ExpressionTree)exp);
reader.moveUp();
}
task.setTaskExpressionTreesOrdered(taskExpressions);
return task;
}
示例6: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Class<? extends IdCloneable> idClass = context.getRequiredType();
IdCloneable newIdType;
try
{
newIdType = idClass.newInstance();
reader.moveDown();
String value = reader.getValue();
newIdType.setId(Long.parseLong(value));
reader.moveUp();
return newIdType;
}
catch( Exception e )
{
throw Throwables.propagate(e);
}
}
示例7: resolveClass
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@Override
public Class resolveClass(HierarchicalStreamReader reader)
{
String xclass = reader.getAttribute(XCLASS);
Class clazz2use = null;
if( xclass != null )
{
try
{
clazz2use = Class.forName(xclass, false, Thread.currentThread().getContextClassLoader());
}
catch( ClassNotFoundException e )
{
throw new RuntimeException(e);
}
}
return clazz2use;
}
示例8: getUnmarshalledValue
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@Override
protected Object getUnmarshalledValue(Object object, HierarchicalStreamReader reader, UnmarshallingContext context)
{
Object value = super.getUnmarshalledValue(object, reader, context);
try
{
if( value != null )
{
value = format.parseObject(value.toString());
}
}
catch( ParseException e )
{
value = null;
}
return value;
}
示例9: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的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;
}
示例10: recurseUnmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
public void recurseUnmarshal(Object object, HierarchicalStreamReader reader, UnmarshallingContext context,
String path, XMLDataMappings mappings)
{
Collection<AbstractMapping> col = getMapping(mappings.getMappings(), path);
for( AbstractMapping nodeMap : col )
{
nodeMap.unmarshal(reader, context, object);
if( nodeMap instanceof ElementMapping )
{
return;
}
}
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String thispath = path + SLASH + processNodeName(mappings, reader.getNodeName());
recurseUnmarshal(object, reader, context, thispath, mappings);
}
}
示例11: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@Override
@SuppressWarnings({"unchecked", "nls"})
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
String classFromStream = reader.getAttribute("entityclass"); //$NON-NLS-1$
String uuidFromStream = reader.getAttribute("uuid"); //$NON-NLS-1$
try
{
AbstractEntityService<?, ? extends BaseEntity> service = registry
.getServiceForClass((Class<? extends BaseEntity>) Class.forName(classFromStream));
if( service == null )
{
throw new RuntimeException("Could not find service for class '" + classFromStream
+ "' in entity registry!");
}
return service.getByUuid(uuidFromStream);
}
catch( ClassNotFoundException e )
{
throw new RuntimeException(e);
}
}
示例12: copy
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
public void copy(HierarchicalStreamReader source, HierarchicalStreamWriter destination) {
destination.startNode(source.getNodeName());
int attributeCount = source.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
destination.addAttribute(source.getAttributeName(i), source.getAttribute(i));
}
String value = source.getValue();
if (value != null && value.length() > 0) {
destination.setValue(value);
}
while (source.hasMoreChildren()) {
source.moveDown();
copy(source, destination);
source.moveUp();
}
destination.endNode();
}
示例13: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@SuppressWarnings("nls")
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
MetadataFormat format = new MetadataFormat();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
String value = reader.getValue();
if( name.equals("oai:metadataPrefix") || name.equals("metadataPrefix") )
{
format.setMetadataPrefix(value);
}
else if( name.equals("oai:schema") || name.equals("schema") )
{
format.setSchema(value);
}
else if( name.equals("oai:metadataNamespace") || name.equals("metadataNamespace") )
{
format.setMetadataNamespace(value);
}
}
return format;
}
示例14: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Record record = new Record();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
if( name.equals("metadata") )
{
reader.moveDown();
Object object = new OAIDOMConverter().unmarshal(reader, context);
record.setMetadata(object);
reader.moveUp();
}
else if( name.equals("header") )
{
Header header = (Header) convert(name, context);
record.setHeader(header);
}
}
return record;
}
示例15: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
Object result = defaultConverter.unmarshal(reader, context);
if (result != null) {
String className = result.getClass().getName();
// During deserialize XML file into object, it will save file node into fileNodes
for (NameInfo name : fileHandleClassList) {
if (name.className.equals(className)) {
fileNodes.add(ExportToolContentService.this.new ValueInfo(name, result));
break;
}
}
}
return result;
}