use of com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator 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;
}
Aggregations