use of ezvcard.property.StructuredName in project ez-vcard by mangstadt.
the class StructuredNameScribe method _parseText.
@Override
protected StructuredName _parseText(String value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
StructuredName property = new StructuredName();
if (context.getVersion() == VCardVersion.V2_1) {
/*
* 2.1 does not recognize multi-valued components.
*/
SemiStructuredValueIterator it = new SemiStructuredValueIterator(value);
property.setFamily(it.next());
property.setGiven(it.next());
String next = it.next();
if (next != null) {
property.getAdditionalNames().add(next);
}
next = it.next();
if (next != null) {
property.getPrefixes().add(next);
}
next = it.next();
if (next != null) {
property.getSuffixes().add(next);
}
} else {
StructuredValueIterator it = new StructuredValueIterator(value);
property.setFamily(it.nextValue());
property.setGiven(it.nextValue());
property.getAdditionalNames().addAll(it.nextComponent());
property.getPrefixes().addAll(it.nextComponent());
property.getSuffixes().addAll(it.nextComponent());
}
return property;
}
use of ezvcard.property.StructuredName in project ez-vcard by mangstadt.
the class StructuredNameScribe method _parseXml.
@Override
protected StructuredName _parseXml(XCardElement element, VCardParameters parameters, ParseContext context) {
StructuredName property = new StructuredName();
property.setFamily(s(element.first("surname")));
property.setGiven(s(element.first("given")));
property.getAdditionalNames().addAll(element.all("additional"));
property.getPrefixes().addAll(element.all("prefix"));
property.getSuffixes().addAll(element.all("suffix"));
return property;
}
Aggregations