use of ezvcard.io.text.WriteContext in project ez-vcard by mangstadt.
the class VCardPropertyScribe method _writeXml.
/**
* <p>
* Marshals a property's value to an XML element (xCard).
* </p>
* <p>
* This method should be overridden by child classes that wish to support
* xCard. The default implementation of this method will append one child
* element to the property's XML element. The child element's name will be
* that of the property's data type (retrieved using the {@link #dataType}
* method), and the child element's text content will be set to the
* property's marshalled plain-text value (retrieved using the
* {@link #writeText} method).
* </p>
* @param property the property
* @param element the property's XML element
* @throws SkipMeException if the property should not be written to the data
* stream
*/
protected void _writeXml(T property, XCardElement element) {
String value = writeText(property, new WriteContext(VCardVersion.V4_0, null, false));
VCardDataType dataType = dataType(property, VCardVersion.V4_0);
element.append(dataType, value);
}
use of ezvcard.io.text.WriteContext in project ez-vcard by mangstadt.
the class AgentScribeTest method writeText.
@Test
public void writeText() {
sensei.assertWriteText(withUrl).run(url);
for (VCardVersion version : values()) {
try {
scribe.writeText(withVCard, new WriteContext(version, null, false));
fail();
} catch (EmbeddedVCardException e) {
assertEquals(vcard, e.getVCard());
}
}
sensei.assertWriteText(empty).skipMe();
}
Aggregations