/** * Writes the attribute value. Optionally emits empty string values. * * @param localName the local name of the attribute. * @param alwaysWriteEmptyString always emit the empty string as the value. * @param value the value * @throws ServiceXmlSerializationException the service xml serialization exception */ public void writeAttributeValue(String localName, boolean alwaysWriteEmptyString, Object value) throws ServiceXmlSerializationException { OutParam<String> stringOut = new OutParam<String>(); String stringValue = null; if (this.tryConvertObjectToString(value, stringOut)) { stringValue = stringOut.getParam(); if ((null != stringValue) && (alwaysWriteEmptyString || (stringValue.length() != 0))) { this.writeAttributeString(localName, stringValue); } } else { throw new ServiceXmlSerializationException(String.format( "Values of type '%s' can't be used for the '%s' attribute.", value.getClass() .getName(), localName)); } }
/** * Writes the attribute value. * * @param namespacePrefix the namespace prefix * @param localName the local name of the attribute * @param value the value * @throws ServiceXmlSerializationException the service xml serialization exception */ public void writeAttributeValue(String namespacePrefix, String localName, Object value) throws ServiceXmlSerializationException { OutParam<String> stringOut = new OutParam<String>(); String stringValue = null; if (this.tryConvertObjectToString(value, stringOut)) { stringValue = stringOut.getParam(); if (null != stringValue && !stringValue.isEmpty()) { this.writeAttributeString(namespacePrefix, localName, stringValue); } } else { throw new ServiceXmlSerializationException(String.format( "Values of type '%s' can't be used for the '%s' attribute.", value.getClass() .getName(), localName)); } }
/** * Writes the attribute value. Optionally emits empty string values. * * @param localName the local name of the attribute. * @param alwaysWriteEmptyString always emit the empty string as the value. * @param value the value * @throws ServiceXmlSerializationException the service xml serialization exception */ public void writeAttributeValue(String localName, boolean alwaysWriteEmptyString, Object value) throws ServiceXmlSerializationException { OutParam<String> stringOut = new OutParam<String>(); String stringValue = null; if (this.tryConvertObjectToString(value, stringOut)) { stringValue = stringOut.getParam(); if ((null != stringValue) && (alwaysWriteEmptyString || (stringValue.length() != 0))) { this.writeAttributeString(localName, stringValue); } } else { throw new ServiceXmlSerializationException(String.format( "Values of type '%s' can't be used for the '%s' attribute.", value.getClass() .getName(), localName)); } }
/** * Writes the attribute value. * * @param namespacePrefix the namespace prefix * @param localName the local name of the attribute * @param value the value * @throws ServiceXmlSerializationException the service xml serialization exception */ public void writeAttributeValue(String namespacePrefix, String localName, Object value) throws ServiceXmlSerializationException { OutParam<String> stringOut = new OutParam<String>(); String stringValue = null; if (this.tryConvertObjectToString(value, stringOut)) { stringValue = stringOut.getParam(); if (null != stringValue && !stringValue.isEmpty()) { this.writeAttributeString(namespacePrefix, localName, stringValue); } } else { throw new ServiceXmlSerializationException(String.format( "Values of type '%s' can't be used for the '%s' attribute.", value.getClass() .getName(), localName)); } }