use of com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator in project ez-vcard by mangstadt.
the class StructuredNameScribe method _parseJson.
@Override
protected StructuredName _parseJson(JCardValue value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
StructuredName property = new StructuredName();
StructuredValueIterator it = new StructuredValueIterator(value.asStructured());
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 com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator in project ez-vcard by mangstadt.
the class GenderScribe method _parseJson.
@Override
protected Gender _parseJson(JCardValue value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
StructuredValueIterator it = new StructuredValueIterator(value.asStructured());
String sex = it.nextValue();
if (sex != null) {
sex = sex.toUpperCase();
}
String text = it.nextValue();
Gender property = new Gender(sex);
property.setText(text);
return property;
}
use of com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator in project ez-vcard by mangstadt.
the class OrganizationScribe method _parseJson.
@Override
protected Organization _parseJson(JCardValue value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
Organization property = new Organization();
StructuredValueIterator it = new StructuredValueIterator(value.asStructured());
while (it.hasNext()) {
String next = it.nextValue();
if (next != null) {
property.getValues().add(next);
}
}
return property;
}
use of com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator in project vinnie by mangstadt.
the class VObjectPropertyValuesTest method StructuredValueIterator.
@Test
public void StructuredValueIterator() {
StructuredValueIterator it = new StructuredValueIterator("one;two;;;three,four");
assertTrue(it.hasNext());
assertEquals("one", it.nextValue());
assertTrue(it.hasNext());
assertEquals(asList("two"), it.nextComponent());
assertTrue(it.hasNext());
assertNull(it.nextValue());
assertTrue(it.hasNext());
assertEquals(asList(), it.nextComponent());
assertTrue(it.hasNext());
assertEquals(asList("three", "four"), it.nextComponent());
assertFalse(it.hasNext());
assertNull(it.nextValue());
assertEquals(asList(), it.nextComponent());
}
use of com.github.mangstadt.vinnie.io.VObjectPropertyValues.StructuredValueIterator in project ez-vcard by mangstadt.
the class ClientPidMapScribe method _parseJson.
@Override
protected ClientPidMap _parseJson(JCardValue value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
StructuredValueIterator it = new StructuredValueIterator(value.asStructured());
String pid = it.nextValue();
String uri = it.nextValue();
return parse(pid, uri);
}
Aggregations