本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
}
示例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>
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}