node.setValue(e.getValue()); node.getAttributes().remove("class"); first = false;
/** * This is used to attach elements or attributes to the given * element during the serialization process. This method allows * the strategy to augment the XML document so that it can be * deserialized using a similar strategy. For example the * default strategy adds a "class" attribute to the element. * * @param type this is the field type for the associated value * @param value this is the instance variable being serialized * @param node this is the element used to represent the value * * @return this returns true if serialization has complete * * @throws Exception thrown if the details cannot be set */ public boolean setOverride(Type type, Object value, OutputNode node) throws Exception { NodeMap<OutputNode> map = node.getAttributes(); if(map == null) { throw new PersistenceException("No attributes for %s", node); } return strategy.write(type, value, map, session); }
String className = element.getAttributes().get("class").getValue(); Class localClass = Class.forName(className); boolean shouldShortenName = ObjectBase.class.isAssignableFrom(localClass); if (shouldShortenName) element.getAttributes().remove("class"); element.setName(localClass.getSimpleName());
/** * This is used to attach elements or attributes to the given * element during the serialization process. This method allows * the strategy to augment the XML document so that it can be * deserialized using a similar strategy. For example the * default strategy adds a "class" attribute to the element. * * @param type this is the field type for the associated value * @param value this is the instance variable being serialized * @param node this is the element used to represent the value * * @return this returns true if serialization has complete * * @throws Exception thrown if the details cannot be set */ public boolean setOverride(Type type, Object value, OutputNode node) throws Exception { NodeMap<OutputNode> map = node.getAttributes(); if(map == null) { throw new PersistenceException("No attributes for %s", node); } return strategy.write(type, value, map, session); }
/** * This is used to attach elements or attributes to the given * element during the serialization process. This method allows * the strategy to augment the XML document so that it can be * deserialized using a similar strategy. For example the * default strategy adds a "class" attribute to the element. * * @param type this is the field type for the associated value * @param value this is the instance variable being serialized * @param node this is the element used to represent the value * * @return this returns true if serialization has complete * * @throws Exception thrown if the details cannot be set */ public boolean setOverride(Type type, Object value, OutputNode node) throws Exception { NodeMap<OutputNode> map = node.getAttributes(); if(map == null) { throw new PersistenceException("No attributes for %s", node); } return strategy.write(type, value, map, session); }
/** * This is used to write the attributes of the specified node to * the output. This will iterate over each node entered on to * the node. Once written the node is considered inactive. * * @param node this is the node to have is attributes written */ private void writeAttributes(OutputNode node) throws Exception { NodeMap<OutputNode> map = node.getAttributes(); for(String name : map) { OutputNode entry = map.get(name); String value = entry.getValue(); String prefix = entry.getPrefix(verbose); writer.writeAttribute(name, value, prefix); } active.remove(node); }
@Override public void write(OutputNode output, Object source, Class type, XmlWriteContext delegate) { boolean complete; try { complete = strategy.write(new ClassType(type), source, output.getAttributes(), delegate); } catch (XmlPersisterException exception) { throw exception; } catch (Exception exception) { throw new XmlPersisterException(exception); } if (!complete) { throw new XmlPersisterException(format("Failed writing %s to %s", type, output)); } }
/** * This is used to write the attributes of the specified node to * the output. This will iterate over each node entered on to * the node. Once written the node is considered inactive. * * @param node this is the node to have is attributes written */ private void writeAttributes(OutputNode node) throws Exception { NodeMap<OutputNode> map = node.getAttributes(); for(String name : map) { OutputNode entry = map.get(name); String value = entry.getValue(); String prefix = entry.getPrefix(verbose); writer.writeAttribute(name, value, prefix); } active.remove(node); }
/** * This is used to write the attributes of the specified node to * the output. This will iterate over each node entered on to * the node. Once written the node is considered inactive. * * @param node this is the node to have is attributes written */ private void writeAttributes(OutputNode node) throws Exception { NodeMap<OutputNode> map = node.getAttributes(); for(String name : map) { OutputNode entry = map.get(name); String value = entry.getValue(); String prefix = entry.getPrefix(verbose); writer.writeAttribute(name, value, prefix); } active.remove(node); }
@Override public OutputNode writeAttribute(OutputNode output, String namespace, String attribute, Object source) { OutputNode node = null; if (!skip(null, source)) { NodeMap<OutputNode> attributes = output.getAttributes(); node = attributes.get(attribute); if (node == null) { node = attributes.put(attribute, EMPTY); } node.setReference(namespace == null ? EMPTY : namespace); write(node, source); } return node; }