当前位置: 首页>>代码示例>>Java>>正文


Java MarshallingContext.convertAnother方法代码示例

本文整理汇总了Java中com.thoughtworks.xstream.converters.MarshallingContext.convertAnother方法的典型用法代码示例。如果您正苦于以下问题:Java MarshallingContext.convertAnother方法的具体用法?Java MarshallingContext.convertAnother怎么用?Java MarshallingContext.convertAnother使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.xstream.converters.MarshallingContext的用法示例。


在下文中一共展示了MarshallingContext.convertAnother方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
/**
 * writes the argument <code>value</code> to the XML file specified through
 * <code>writer</code>
 *
 * @pre     <code>value</code> is a valid <code>Expression</code>, <code>
 *          writer</code> is a valid <code>HierarchicalStreamWriter</code>, and
 * <code>context</code> is a valid <code>MarshallingContext</code>
 * @post    <code>value</code> is written to the XML file specified via
 * <code>writer</code>
 * @param value   <code>Expression</code> that you wish to write to a file
 * @param writer stream to write through
 * @param context <code>MarshallingContext</code> used to store generic data
 */
@Override
public void marshal(Object value, HierarchicalStreamWriter writer,
        MarshallingContext context) {

    Expression expression = (Expression) value;

    writer.startNode("name");
    writer.setValue(expression.getName());
    writer.endNode();

    writer.startNode("excelExpressionString");
    writer.setValue(expression.getExcelExpressionString());
    writer.endNode();

    writer.startNode("expressionTree");
    context.convertAnother(expression.getExpressionTree());
    writer.endNode();
}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:32,代码来源:ExpressionXMLConverter.java

示例2: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
/**
 * writes the argument <code>value</code> to the XML file specified through
 * <code>writer</code>
 *
 * @pre     <code>value</code> is a valid <code>ShrimpSpeciesNode</code>, <code>
 *          writer</code> is a valid <code>HierarchicalStreamWriter</code>, and
 * <code>context</code> is a valid <code>MarshallingContext</code>
 * @post    <code>value</code> is written to the XML file specified via
 * <code>writer</code>
 * @param value   <code>ShrimpSpeciesNode</code> that you wish to write to a
 * file
 * @param writer stream to write through
 * @param context <code>MarshallingContext</code> used to store generic data
 */
@Override
public void marshal(Object value, HierarchicalStreamWriter writer,
        MarshallingContext context) {

    ShrimpSpeciesNode shrimpSpeciesNode = (ShrimpSpeciesNode) value;
    
    writer.startNode("isotopeName");
    writer.setValue(shrimpSpeciesNode.getName());
    writer.endNode();

    writer.startNode("squidSpeciesModel");
    context.convertAnother(shrimpSpeciesNode.getSquidSpeciesModel());
    writer.endNode();
    
    writer.startNode("methodNameForShrimpFraction");
    writer.setValue(shrimpSpeciesNode.getMethodNameForShrimpFraction());
    writer.endNode();

}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:34,代码来源:ShrimpSpeciesNodeXMLConverter.java

示例3: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
/**
 * writes the argument <code>value</code> to the XML file specified through
 * <code>writer</code>
 *
 * @pre     <code>value</code> is a valid <code>Task</code>, <code>
 *          writer</code> is a valid <code>HierarchicalStreamWriter</code>, and
 * <code>context</code> is a valid <code>MarshallingContext</code>
 * @post    <code>value</code> is written to the XML file specified via
 * <code>writer</code>
 * @param value   <code>Task</code> that you wish to write to a file
 * @param writer stream to write through
 * @param context <code>MarshallingContext</code> used to store generic data
 */
@Override
public void marshal(Object value, HierarchicalStreamWriter writer,
        MarshallingContext context) {

    TaskInterface task = (Task) value;

    writer.startNode("name");
    writer.setValue(task.getName());
    writer.endNode();

    writer.startNode("taskExpressionsOrdered");
    context.convertAnother(task.getTaskExpressionTreesOrdered());
    writer.endNode();

}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:29,代码来源:TaskXMLConverter.java

示例4: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
public void marshal(final Object original, final HierarchicalStreamWriter writer, final MarshallingContext context) {
    final Object source = serializationMethodInvoker.callWriteReplace(original);

    if (source != original && context instanceof ReferencingMarshallingContext) {
        ((ReferencingMarshallingContext<?>)context).replace(original, source);
    }
    if (source.getClass() != original.getClass()) {
        final String attributeName = mapper.aliasForSystemAttribute("resolves-to");
        if (attributeName != null) {
            writer.addAttribute(attributeName, mapper.serializedClass(source.getClass()));
        }
        context.convertAnother(source);
    } else {
        doMarshal(source, writer, context);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AbstractReflectionConverter.java

示例5: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
    final int length = Array.getLength(source);
    for (int i = 0; i < length; ++i) {
        final Object item = Array.get(source, i);
        final Class<?> itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive()
            ? Primitives.unbox(item.getClass())
            : item.getClass();
        ExtendedHierarchicalStreamWriterHelper.startNode(writer, itemName, itemType);
        if (!itemType.equals(arrayType.getComponentType())) {
            final String attributeName = mapper.aliasForSystemAttribute("class");
            if (attributeName != null) {
                writer.addAttribute(attributeName, mapper.serializedClass(itemType));
            }
        }
        if (item != null) {
            context.convertAnother(item);
        }
        writer.endNode();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:NamedArrayConverter.java

示例6: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
    final Font font = (Font)source;
    final Map<TextAttribute, ?> attributes = font.getAttributes();
    if (mapper != null) {
        final String classAlias = mapper.aliasForSystemAttribute("class");
        for (final Map.Entry<TextAttribute, ?> entry : attributes.entrySet()) {
            final String name = textAttributeConverter.toString(entry.getKey());
            final Object value = entry.getValue();
            final Class<?> type = value != null ? value.getClass() : Mapper.Null.class;
            ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, type);
            writer.addAttribute(classAlias, mapper.serializedClass(type));
            if (value != null) {
                context.convertAnother(value);
            }
            writer.endNode();
        }
    } else {
        writer.startNode("attributes"); // <attributes>
        context.convertAnother(attributes);
        writer.endNode(); // </attributes>
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:FontConverter.java

示例7: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
public void marshal(final Object original, final HierarchicalStreamWriter writer,
        final MarshallingContext context) {
    final Object source = serializationMembers.callWriteReplace(original);

    if (source != original && context instanceof ReferencingMarshallingContext) {
        ((ReferencingMarshallingContext<?>)context).replace(original, source);
    }
    if (source.getClass() != original.getClass()) {
        final String attributeName = mapper.aliasForSystemAttribute("resolves-to");
        if (attributeName != null) {
            writer.addAttribute(attributeName, mapper.serializedClass(source.getClass()));
        }
        context.convertAnother(source);
    } else {
        doMarshal(source, writer, context);
    }
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:19,代码来源:AbstractReflectionConverter.java

示例8: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
/**
 * writes the argument <code>value</code> to the XML file specified through <code>writer</code>
 * 
 * @pre     <code>value</code> is a valid <code>PbBlank</code>, <code>
 *          writer</code> is a valid <code>HierarchicalStreamWriter</code>,
 *          and <code>context</code> is a valid <code>MarshallingContext</code>
 * @post    <code>value</code> is written to the XML file specified via <code>writer</code>
 * @param   value   <code>PbBlank</code> that you wish to write to a file
 * @param   writer  stream to write through
 * @param   context <code>MarshallingContext</code> used to store generic data
 */
public void marshal(Object value, HierarchicalStreamWriter writer,
        MarshallingContext context) {
    
    PbBlank pbBlank = (PbBlank) value;
    
    writer.startNode("name");
    writer.setValue(pbBlank.getName());
    writer.endNode();
    
    writer.startNode("ratios");
    context.convertAnother(pbBlank.getRatios());
    writer.endNode();
    
    writer.startNode("rhoCorrelations");
    context.convertAnother(pbBlank.getRhoCorrelations());
    writer.endNode();
    
}
 
开发者ID:CIRDLES,项目名称:ET_Redux,代码行数:30,代码来源:PbBlankXMLConverter.java

示例9: writeValue

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
protected void writeValue(HierarchicalStreamWriter writer, MarshallingContext context, Object value) {
    final Class clazz = value.getClass();
    final String propertyClass = mapper.serializedClass(clazz);
    writer.addAttribute("propertyClass", propertyClass);
    context.convertAnother(value);
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:8,代码来源:ObjectPropertyConverter.java

示例10: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
public void marshal(HierarchicalStreamWriter writer, MarshallingContext context, Object object)
{
	if( name.length() > 0 )
	{
		object = getField(object);
	}

	resolver.writeClass(writer, object);
	context.convertAnother(object);
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:DataMapping.java

示例11: marshalComparator

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
protected void marshalComparator(final Comparator<?> comparator, final HierarchicalStreamWriter writer,
        final MarshallingContext context) {
    if (comparator != null) {
        writer.startNode("comparator");
        writer.addAttribute(mapper().aliasForSystemAttribute("class"), mapper().serializedClass(
            comparator.getClass()));
        context.convertAnother(comparator);
        writer.endNode();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:TreeMapConverter.java

示例12: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
    final InvocationHandler invocationHandler = Proxy.getInvocationHandler(source);
    addInterfacesToXml(source, writer);
    writer.startNode("handler");
    final String attributeName = mapper.aliasForSystemAttribute("class");
    if (attributeName != null) {
        writer.addAttribute(attributeName, mapper.serializedClass(invocationHandler.getClass()));
    }
    context.convertAnother(invocationHandler);
    writer.endNode();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:DynamicProxyConverter.java

示例13: writeItem

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
protected void writeItem(final String name, final Class<?> type, final Object item,
        final MarshallingContext context, final HierarchicalStreamWriter writer) {
    final Class<?> itemType = item == null ? Mapper.Null.class : item.getClass();
    ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, itemType);
    if (!itemType.equals(type)) {
        final String attributeName = mapper().aliasForSystemAttribute("class");
        if (attributeName != null) {
            writer.addAttribute(attributeName, mapper().serializedClass(itemType));
        }
    }
    if (item != null) {
        context.convertAnother(item);
    }
    writer.endNode();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:NamedMapConverter.java

示例14: writeItem

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
@Override
protected void writeItem(final Object item, final MarshallingContext context, final HierarchicalStreamWriter writer) {
    final Class<?> itemType = item == null ? Mapper.Null.class : item.getClass();
    ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, itemType);
    if (!itemType.equals(type)) {
        final String attributeName = mapper().aliasForSystemAttribute("class");
        if (attributeName != null) {
            writer.addAttribute(attributeName, mapper().serializedClass(itemType));
        }
    }
    if (item != null) {
        context.convertAnother(item);
    }
    writer.endNode();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:NamedCollectionConverter.java

示例15: marshal

import com.thoughtworks.xstream.converters.MarshallingContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
    ScriptWrapper wrap = (ScriptWrapper) arg0;
    String version = SaveService.getVERSION();
    ConversionHelp.setOutVersion(version);// Ensure output follows version
    writer.addAttribute(ATT_VERSION, version);
    writer.addAttribute(ATT_PROPERTIES, SaveService.getPropertiesVersion());
    writer.addAttribute(ATT_JMETER, JMeterUtils.getJMeterVersion());
    writer.startNode(classMapper.serializedClass(wrap.testPlan.getClass()));
    context.convertAnother(wrap.testPlan);
    writer.endNode();
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:16,代码来源:ScriptWrapperConverter.java


注:本文中的com.thoughtworks.xstream.converters.MarshallingContext.convertAnother方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。