当前位置: 首页>>代码示例>>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;未经允许,请勿转载。