use of ezvcard.property.Gender in project ez-vcard by mangstadt.
the class GenderScribe method _parseText.
@Override
protected Gender _parseText(String value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
SemiStructuredValueIterator it = new SemiStructuredValueIterator(value, 2);
String sex = it.next();
if (sex != null) {
sex = sex.toUpperCase();
}
String text = it.next();
Gender property = new Gender(sex);
property.setText(text);
return property;
}
use of ezvcard.property.Gender 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 ezvcard.property.Gender in project ez-vcard by mangstadt.
the class GenderScribe method _parseXml.
@Override
protected Gender _parseXml(XCardElement element, VCardParameters parameters, ParseContext context) {
String sex = element.first("sex");
if (sex != null) {
Gender property = new Gender(sex);
// optional field
property.setText(element.first("identity"));
return property;
}
throw missingXmlElements("sex");
}
Aggregations