當前位置: 首頁>>代碼示例>>Java>>正文


Java HierarchicalStreamReader.moveDown方法代碼示例

本文整理匯總了Java中com.thoughtworks.xstream.io.HierarchicalStreamReader.moveDown方法的典型用法代碼示例。如果您正苦於以下問題:Java HierarchicalStreamReader.moveDown方法的具體用法?Java HierarchicalStreamReader.moveDown怎麽用?Java HierarchicalStreamReader.moveDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.thoughtworks.xstream.io.HierarchicalStreamReader的用法示例。


在下文中一共展示了HierarchicalStreamReader.moveDown方法的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;
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:35,代碼來源:ExpressionXMLConverter.java

示例2: 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;
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:30,代碼來源:SpotFieldNodeNodeXMLConverter.java

示例3: 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();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:HierarchicalStreamCopier.java

示例4: 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;
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:37,代碼來源:TaskXMLConverter.java

示例5: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    String methodName = null;
    String declaringClassName = null;

    while ((methodName == null || declaringClassName == null) && reader.hasMoreChildren()) {
        reader.moveDown();

        if (reader.getNodeName().equals("name")) {
            methodName = reader.getValue();
        } else if (reader.getNodeName().equals("clazz")) {
            declaringClassName = reader.getValue();
        }
        reader.moveUp();
    }

    final Class<?> declaringClass = (Class<?>)javaClassConverter.fromString(declaringClassName);
    try {
        return declaringClass.getDeclaredField(mapper.realMember(declaringClass, methodName));
    } catch (final NoSuchFieldException e) {
        throw new ConversionException(e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:JavaFieldConverter.java

示例6: unmarshalComparator

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
protected Comparator<?> unmarshalComparator(final HierarchicalStreamReader reader,
        final UnmarshallingContext context, final TreeMap<?, ?> result) {
    final Comparator<?> comparator;
    if (reader.hasMoreChildren()) {
        reader.moveDown();
        if (reader.getNodeName().equals("comparator")) {
            final Class<?> comparatorClass = HierarchicalStreams.readClassType(reader, mapper());
            comparator = (Comparator<?>)context.convertAnother(result, comparatorClass);
        } else if (reader.getNodeName().equals("no-comparator")) { // pre 1.4 format
            comparator = null;
        } else {
            // we are already within the first entry
            return NULL_MARKER;
        }
        reader.moveUp();
    } else {
        comparator = null;
    }
    return comparator;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:TreeMapConverter.java

示例7: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    final Object result = instantiateNewInstance(context);
    final Set<FastField> seenProperties = new HashSet<FastField>() {
        @Override
        public boolean add(final FastField e) {
            if (!super.add(e)) {
                throw new DuplicatePropertyException(e.getName());
            }
            return true;
        }
    };

    final Class<?> resultType = result.getClass();
    while (reader.hasMoreChildren()) {
        reader.moveDown();

        final String propertyName = mapper.realMember(resultType, reader.getNodeName());

        if (mapper.shouldSerializeMember(resultType, propertyName)) {
            final boolean propertyExistsInClass = beanProvider.propertyDefinedInClass(propertyName, resultType);

            if (propertyExistsInClass) {
                final Class<?> type = determineType(reader, result, propertyName);
                final Object value = context.convertAnother(result, type);
                beanProvider.writeProperty(result, propertyName, value);
                seenProperties.add(new FastField(resultType, propertyName));
            } else {
                throw new MissingFieldException(resultType.getName(), propertyName);
            }
        }
        reader.moveUp();
    }

    return result;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:37,代碼來源:JavaBeanConverter.java

示例8: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    Map<String, String> map = new HashMap<>();
    while(reader.hasMoreChildren()) {
        reader.moveDown();

        String key = reader.getNodeName(); // nodeName aka element's name
        String value = reader.getValue();
        map.put(key, value);

        reader.moveUp();
    }

    return map;
}
 
開發者ID:superkoh,項目名稱:k-framework,代碼行數:15,代碼來源:MapEntryConverter.java

示例9: populateMap

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
protected void populateMap(final HierarchicalStreamReader reader, final UnmarshallingContext context,
        final Map<?, ?> map, final Map<?, ?> target) {
    while (reader.hasMoreChildren()) {
        reader.moveDown();
        putCurrentEntryIntoMap(reader, context, map, target);
        reader.moveUp();
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:MapConverter.java

示例10: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    try {
        final boolean isMethodNotConstructor = context.getRequiredType().equals(Method.class);

        reader.moveDown();
        final String declaringClassName = reader.getValue();
        final Class<?> declaringClass = (Class<?>)javaClassConverter.fromString(declaringClassName);
        reader.moveUp();

        String methodName = null;
        if (isMethodNotConstructor) {
            reader.moveDown();
            methodName = reader.getValue();
            reader.moveUp();
        }

        reader.moveDown();
        final List<Class<?>> parameterTypeList = new ArrayList<Class<?>>();
        while (reader.hasMoreChildren()) {
            reader.moveDown();
            final String parameterTypeName = reader.getValue();
            parameterTypeList.add((Class<?>)javaClassConverter.fromString(parameterTypeName));
            reader.moveUp();
        }
        final Class<?>[] parameterTypes = parameterTypeList.toArray(new Class[parameterTypeList.size()]);
        reader.moveUp();

        if (isMethodNotConstructor) {
            return declaringClass.getDeclaredMethod(methodName, parameterTypes);
        } else {
            return declaringClass.getDeclaredConstructor(parameterTypes);
        }
    } catch (final NoSuchMethodException e) {
        throw new ConversionException(e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:38,代碼來源:JavaMethodConverter.java

示例11: parseSubTree2

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
private Element parseSubTree2(HierarchicalStreamReader reader, Document doc)
{
	String qname = reader.getNodeName();
	Element parent = doc.createElement(qname);

	Iterator i = reader.getAttributeNames();
	while( i.hasNext() )
	{
		String aname = i.next().toString();
		String value = reader.getAttribute(aname);
		parent.setAttribute(aname, value);
	}

	String text = reader.getValue();
	if( text.trim().length() != 0 )
	{
		Text textEl = doc.createTextNode(text);
		parent.appendChild(textEl);
	}

	for( ; reader.hasMoreChildren(); reader.moveUp() )
	{
		reader.moveDown();
		Element child = parseSubTree2(reader, doc);
		parent.appendChild(child);
	}

	return parent;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:30,代碼來源:ElementMapping.java

示例12: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
/**
 * Method is used unmarshal XML of any type of component which contains a
 * List<String> where the string elements would appear within <ID> tags.
 * E.g. the List<String> of inputRoutes and outputRoutes in
 * CommunicationPoint.
 *
 * @return a List<String> of all IDs.
 */
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
	final List<String> IdList = new ArrayList<String>();
	while (reader.hasMoreChildren()) {
		reader.moveDown();
		final String nodeName = reader.getNodeName();
		final String value = reader.getValue();
		if (nodeName.equalsIgnoreCase("ID")) {
			IdList.add(value);
		}
		reader.moveUp();
	}
	return IdList;
}
 
開發者ID:orionhealth,項目名稱:rlc-analyser,代碼行數:23,代碼來源:ListToStringXStreamConverter.java

示例13: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    final Map<String, Integer> elements = new HashMap<String, Integer>();
    while (reader.hasMoreChildren()) {
        reader.moveDown();
        elements.put(reader.getNodeName(), Integer.valueOf(reader.getValue()));
        reader.moveUp();
    }
    return new Color(elements.get("red").intValue(), elements.get("green").intValue(), elements
        .get("blue")
        .intValue(), elements.get("alpha").intValue());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:ColorConverter.java

示例14: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
	Set set = new Set();
	for( ; reader.hasMoreChildren(); reader.moveUp() )
	{
		reader.moveDown();
		String name = reader.getNodeName();
		String value = reader.getValue();
		if( name.equals("setSpec") )
		{
			set.setSpec(value);
		}
		else if( name.equals("setName") )
		{
			set.setName(value);
		}
		else if( name.equals("setDescription") )
		{
			reader.moveDown();
			Object object = new OAIDOMConverter().unmarshal(reader, context);
			set.setDescription(object);
			reader.moveUp();
		}
	}

	return set;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:29,代碼來源:OAISetConverter.java

示例15: putCurrentEntryIntoMap

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
protected void putCurrentEntryIntoMap(final HierarchicalStreamReader reader, final UnmarshallingContext context,
        final Map<?, ?> map, final Map<?, ?> target) {
    reader.moveDown();
    final Object key = readItem(reader, context, map);
    reader.moveUp();

    reader.moveDown();
    final Object value = readItem(reader, context, map);
    reader.moveUp();

    @SuppressWarnings("unchecked")
    final Map<Object, Object> targetMap = (Map<Object, Object>)target;
    targetMap.put(key, value);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:MapConverter.java


注:本文中的com.thoughtworks.xstream.io.HierarchicalStreamReader.moveDown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。