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


Java HierarchicalStreamReader.getAttribute方法代碼示例

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


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

示例1: 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;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:19,代碼來源:DataMapping.java

示例2: 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);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:BaseEntityXmlConverter.java

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

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

示例5: resolveClass

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Class<?> resolveClass(HierarchicalStreamReader reader)
{
	String name = reader.getAttribute(attribute);
	Class<?> clazz = mapping.get(name);
	if( clazz == null )
	{
		clazz = defaultClass;
	}
	return clazz;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:12,代碼來源:XMLDataResolverMapping.java

示例6: getValue

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
public Object getValue(HierarchicalStreamReader reader)
{
	Object value;
	if( attributeName != null )
	{
		value = reader.getAttribute(attributeName);
	}
	else
	{
		value = reader.getValue();
	}
	return value;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:XMLPath.java

示例7: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
	ItemId id = new ItemId(reader.getAttribute("itemid")); //$NON-NLS-1$
	try
	{
		return itemService.get(id);
	}
	catch( NotFoundException nfe )
	{
		return null;
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:ItemXmlConverter.java

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

示例9: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
	ResumptionToken token = new ResumptionToken();
	String size = reader.getAttribute(COMPLETELISTSIZE);
	String cursor = reader.getAttribute(CURSOR);
	token.setCompleteListSize(parseInt(size, 0));
	token.setCursor(parseInt(cursor, 0));
	token.setToken(reader.getValue());
	return token;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:12,代碼來源:OAIResumptionTokenConverter.java

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

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

示例12: unmarshallElement

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
private void unmarshallElement(HierarchicalStreamReader reader, Branch branch) {
	Element element = branch.addElement(reader.getNodeName());
	for (int i=0; i<reader.getAttributeCount(); i++) {
		String attributeName = reader.getAttributeName(i);
		String attributeValue = reader.getAttribute(i);
		element.addAttribute(attributeName, attributeValue);
	}
	if (StringUtils.isNotBlank(reader.getValue()))
		element.setText(reader.getValue().trim());
	while (reader.hasMoreChildren()) {
		reader.moveDown();
		unmarshallElement(reader, element);
		reader.moveUp();
	}
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:16,代碼來源:JpaConverter.java

示例13: instantiateNewInstance

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的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());
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:AbstractReflectionConverter.java

示例14: determineType

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
private Class<?> determineType(final HierarchicalStreamReader reader, final Object result, final String fieldName) {
    final String classAttributeName = mapper.aliasForSystemAttribute("class");
    final String classAttribute = classAttributeName == null ? null : reader.getAttribute(classAttributeName);
    if (classAttribute != null) {
        return mapper.realClass(classAttribute);
    } else {
        return mapper.defaultImplementationOf(beanProvider.getPropertyType(result, fieldName));
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:JavaBeanConverter.java

示例15: unmarshal

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //導入方法依賴的package包/類
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    final String nullAttribute = reader.getAttribute("null");
    if (nullAttribute != null && nullAttribute.equals("true")) {
        return new Character('\0');
    } else {
        return fromString(reader.getValue());
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:CharConverter.java


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