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


Java HierarchicalStreamReader.getValue方法代碼示例

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


在下文中一共展示了HierarchicalStreamReader.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context)
{
	final WorkflowNodeSupplier supplier = (WorkflowNodeSupplier) context.get(WorkflowNodeSupplier.class);
	final String workflowUuid = reader.getAttribute(ATTR_WORKFLOW);
	final String nodeUuid = reader.getValue();
	long id = supplier.getIdForNode(workflowUuid, nodeUuid);
	final WorkflowItem node = new WorkflowItem();
	if( id != 0 )
	{
		node.setId(id);
	}
	else
	{
		node.setUuid(nodeUuid);
		context.addCompletionCallback(new Runnable()
		{
			@Override
			public void run()
			{
				node.setId(supplier.getIdForNode(workflowUuid, nodeUuid));
			}
		}, 1);
	}
	return node;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:27,代碼來源:WorkflowNodeConverter.java

示例3: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
/**
 * The unmarshal method reads through a Definition to parse the ID and the
 * Name of a Definition. The ID and name of a definition are set and the
 * type of the Definition is set using the suffix of the ID/ Name.
 */
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
	final Definition definition = new Definition();
	String id = null, name = null;
	while (reader.hasMoreChildren()) {
		reader.moveDown();
		final String nodeName = reader.getNodeName();
		String value = reader.getValue();
		value = value == null ? "" : value;
		if (nodeName.equalsIgnoreCase("ID")) {
			id = reader.getValue();
		} else if (nodeName.equalsIgnoreCase("NAME")) {
			name = reader.getValue();
		}
		definition.setId(id != null && !id.isEmpty() ? id : name);
		reader.moveUp();
	}

	definition.setType(DefinitionType.getDefinitionType(definition.getId()));
	return definition;
}
 
開發者ID:orionhealth,項目名稱:rlc-analyser,代碼行數:27,代碼來源:EnumTypeConverter.java

示例4: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    reader.moveDown();
    final long timeInMillis = Long.parseLong(reader.getValue());
    reader.moveUp();
    final String timeZone;
    if (reader.hasMoreChildren()) {
        reader.moveDown();
        timeZone = reader.getValue();
        reader.moveUp();
    } else { // backward compatibility to XStream 1.1.2 and below
        timeZone = TimeZone.getDefault().getID();
    }

    final GregorianCalendar result = new GregorianCalendar();
    result.setTimeZone(TimeZone.getTimeZone(timeZone));
    result.setTimeInMillis(timeInMillis);

    return result;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:GregorianCalendarConverter.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: 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

示例7: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
/**
 * reads a <code>ConstantNode</code> from the XML file specified through
 * <code>reader</code>
 *
 * @pre     <code>reader</code> leads to a valid <code>ConstantNode</code>
 * @post the <code>ConstantNode</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>ConstantNode</code> - <code>ConstantNode</code> read from
 * file specified by <code>reader</code>
 */
@Override
public Object unmarshal(HierarchicalStreamReader reader,
        UnmarshallingContext context) {
    
    ExpressionTreeInterface constantNode = new ConstantNode();
    
    reader.moveDown();
    ((ConstantNode) constantNode).setName(reader.getValue());
    reader.moveUp();
    
    reader.moveDown();
    String constant = reader.getValue();
    if (constant.contains("e")) { // boolean
        ((ConstantNode) constantNode).setValue(Boolean.parseBoolean(reader.getValue()));
    } else if (constant.contains(".")) { // double
        ((ConstantNode) constantNode).setValue(Double.parseDouble(reader.getValue()));
    } else { // integer or string
        try {
            int myInt = Integer.parseInt(reader.getValue());
            ((ConstantNode) constantNode).setValue(myInt);
        } catch (NumberFormatException numberFormatException) {
            // String
            ((ConstantNode) constantNode).setValue(reader.getValue());
        }
    
    }
    
    reader.moveUp();
    
    return constantNode;
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:45,代碼來源:ConstantNodeXMLConverter.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: 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

示例10: unmarshal

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

	for( ; reader.hasMoreChildren(); reader.moveUp() )
	{
		reader.moveDown();
		String name = reader.getNodeName();
		String value = reader.getValue();
		if( name.endsWith("title") )
		{
			response.addTitle(value);
		}
		else if( name.endsWith("creator") )
		{
			response.addCreator(value);
		}
		else if( name.endsWith("subject") )
		{
			response.addSubject(value);
		}
		else if( name.endsWith("description") )
		{
			response.addDescription(value);
		}
		else if( name.endsWith("date") )
		{
			response.addDate(value);
		}
		else if( name.endsWith("identifier") )
		{
			response.addIdentifier(value);
		}
	}

	return response;

}
 
開發者ID:equella,項目名稱:Equella,代碼行數:40,代碼來源:OAIDublinCoreConverter.java

示例11: unmarshal

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

	String status = reader.getAttribute("status");
	header.setStatus(status);

	for( ; reader.hasMoreChildren(); reader.moveUp() )
	{
		reader.moveDown();
		String name = reader.getNodeName();
		String value = reader.getValue();
		if( name.equals("identifier") )
		{
			header.setIdentifier(value);
		}
		else if( name.equals("datestamp") )
		{
			header.setDatestamp(value);
		}
		else if( name.equals("setSpec") )
		{
			header.addSpec(value);
		}
	}

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

示例12: 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();
	int count = reader.getAttributeCount();
	for( int i = 0; i < count; i++ )
	{
		String aname = reader.getAttributeName(i);
		String value = reader.getAttribute(i);
		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,代碼行數:31,代碼來源:OAIDOMConverter.java

示例13: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
	String code = reader.getAttribute("code");
	String message = reader.getValue();
	return new OAIError(code, message);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:8,代碼來源:OAIErrorConverter.java

示例14: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public BitSet unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    final BitSet result = new BitSet();
    final StringTokenizer tokenizer = new StringTokenizer(reader.getValue(), ",", false);
    while (tokenizer.hasMoreTokens()) {
        final int index = Integer.parseInt(tokenizer.nextToken());
        result.set(index);
    }
    return result;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:BitSetConverter.java

示例15: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    final String data = reader.getValue(); // needs to be called before hasMoreChildren.
    if (!reader.hasMoreChildren()) {
        return fromString(data);
    } else {
        // backwards compatibility ... try to unmarshal byte arrays that haven't been encoded
        return unmarshalIndividualByteElements(reader, context);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:EncodedByteArrayConverter.java


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