public void write(OutputNode node, SaltedSecretKey saltedSecretKey) { node.setAttribute("salt", StringUtil.toHex(saltedSecretKey.getSalt())); node.setAttribute("key", StringUtil.toHex(saltedSecretKey.getEncoded())); } }
@Override public void write(OutputNode node, String raw) throws Exception { if (encryptedFields.contains(node.getName())) { node.setValue(TransferSettings.encrypt(raw)); node.setAttribute("encrypted", Boolean.TRUE.toString()); } else { node.setValue(raw); } }
public static void set(OutputNode output, String attribute, String value) { output.setAttribute(attribute, value == null ? EMPTY : value); } }
@Override public void write(OutputNode node, Color value) throws Exception { node.setAttribute("r", "" + value.getRed()); node.setAttribute("g", "" + value.getGreen()); node.setAttribute("b", "" + value.getBlue()); node.setAttribute("a", "" + value.getAlpha()); } }
/** * This method is used to write the value to the specified node. * The value written to the node can be an attribute or an element * depending on the annotation attribute values. This method will * maintain references for serialized elements. * * @param node this is the node that the value is written to * @param item this is the item that is to be written * @param key this is the name of the attribute to be created */ private void writeAttribute(OutputNode node, Object item, String key) throws Exception { if(item != null) { if(key != null) { key = style.getAttribute(key); node = node.setAttribute(key, null); } root.write(node, item); } }
/** * This method is used to write the value to the specified node. * The value written to the node can be an attribute or an element * depending on the annotation attribute values. This method will * maintain references for serialized elements. * * @param node this is the node that the value is written to * @param item this is the item that is to be written * @param key this is the name of the attribute to be created */ private void writeAttribute(OutputNode node, Object item, String key) throws Exception { if(item != null) { if(key != null) { key = style.getAttribute(key); node = node.setAttribute(key, null); } root.write(node, item); } }
/** * This method is used to write the value to the specified node. * The value written to the node can be an attribute or an element * depending on the annotation attribute values. This method will * maintain references for serialized elements. * * @param node this is the node that the value is written to * @param item this is the item that is to be written * @param key this is the name of the attribute to be created */ private void writeAttribute(OutputNode node, Object item, String key) throws Exception { if(item != null) { if(key != null) { key = style.getAttribute(key); node = node.setAttribute(key, null); } root.write(node, item); } }
valueNode.setAttribute("stack", "overflow"); // ... with an attribute
child.setAttribute("num", entry.getKey().toString()); child.getChild("Name").setValue(content.getName()); child.getChild("FNAME").setValue(content.getFName());
/** * This write method is used to set the value of the provided object * as an attribute to the XML element. This will acquire the string * value of the object using <code>toString</code> only if the * object provided is not an enumerated type. If the object is an * enumerated type then the <code>Enum.name</code> method is used. * * @param value this is the value to be set as an attribute * @param node this is the XML element to write the attribute to * @param label the label that contains the contact details */ private void writeAttribute(OutputNode node, Object value, Label label) throws Exception { if(value != null) { Decorator decorator = label.getDecorator(); String name = label.getName(); String text = factory.getText(value); OutputNode done = node.setAttribute(name, text); decorator.decorate(done); } }
/** * This write method is used to set the value of the provided object * as an attribute to the XML element. This will acquire the string * value of the object using <code>toString</code> only if the * object provided is not an enumerated type. If the object is an * enumerated type then the <code>Enum.name</code> method is used. * * @param value this is the value to be set as an attribute * @param node this is the XML element to write the attribute to * @param label the label that contains the contact details */ private void writeAttribute(OutputNode node, Object value, Label label) throws Exception { if(value != null) { Decorator decorator = label.getDecorator(); String name = label.getName(); String text = factory.getText(value); OutputNode done = node.setAttribute(name, text); decorator.decorate(done); } }
/** * This write method is used to set the value of the provided object * as an attribute to the XML element. This will acquire the string * value of the object using <code>toString</code> only if the * object provided is not an enumerated type. If the object is an * enumerated type then the <code>Enum.name</code> method is used. * * @param value this is the value to be set as an attribute * @param node this is the XML element to write the attribute to * @param label the label that contains the contact details */ private void writeAttribute(OutputNode node, Object value, Label label) throws Exception { if(value != null) { Decorator decorator = label.getDecorator(); String name = label.getName(); String text = factory.getText(value); OutputNode done = node.setAttribute(name, text); decorator.decorate(done); } }
/** * This method is used to write the value to the specified node. * This will write the item as an attribute to the provided node, * the name of the attribute is taken from the annotation. * * @param node this is the node that the value is written to * @param item this is the item that is to be written */ private void writeAttribute(OutputNode node, Object item) throws Exception { Class expect = type.getType(); String text = factory.getText(item); String key = entry.getKey(); if(key == null) { key = context.getName(expect); } String name = style.getAttribute(key); if(text != null) { node.setAttribute(name, text); } }
/** * This method is used to write the value to the specified node. * This will write the item as an attribute to the provided node, * the name of the attribute is taken from the annotation. * * @param node this is the node that the value is written to * @param item this is the item that is to be written */ private void writeAttribute(OutputNode node, Object item) throws Exception { Class expect = type.getType(); String text = factory.getText(item); String key = entry.getKey(); if(key == null) { key = context.getName(expect); } String name = style.getAttribute(key); if(text != null) { node.setAttribute(name, text); } }
/** * This method is used to write the value to the specified node. * This will write the item as an attribute to the provided node, * the name of the attribute is taken from the annotation. * * @param node this is the node that the value is written to * @param item this is the item that is to be written */ private void writeAttribute(OutputNode node, Object item) throws Exception { Class expect = type.getType(); String text = factory.getText(item); String key = entry.getKey(); if(key == null) { key = context.getName(expect); } String name = style.getAttribute(key); if(text != null) { node.setAttribute(name, text); } }