use of ezvcard.property.RawProperty in project ez-vcard by mangstadt.
the class RawPropertyScribe method _parseText.
@Override
protected RawProperty _parseText(String value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
RawProperty property = new RawProperty(propertyName, value);
property.setDataType(dataType);
return property;
}
use of ezvcard.property.RawProperty in project ez-vcard by mangstadt.
the class VCard method removeExtendedProperty.
/**
* Removes all extended properties that have the given name.
* @param name the component name (e.g. "X-ALT-DESC")
* @return the properties that were removed (this list is immutable)
*/
public List<RawProperty> removeExtendedProperty(String name) {
List<RawProperty> all = getExtendedProperties();
List<RawProperty> toRemove = new ArrayList<RawProperty>();
for (RawProperty property : all) {
if (property.getPropertyName().equalsIgnoreCase(name)) {
toRemove.add(property);
}
}
all.removeAll(toRemove);
return Collections.unmodifiableList(toRemove);
}
use of ezvcard.property.RawProperty in project ez-vcard by mangstadt.
the class VCardTest method setExtendedProperty.
@Test
public void setExtendedProperty() {
VCard vcard = new VCard();
assertEquals(asList(), vcard.getExtendedProperties());
RawProperty property = vcard.setExtendedProperty("NAME", "value");
assertEquals("NAME", property.getPropertyName());
assertEquals("value", property.getValue());
assertNull(property.getDataType());
assertEquals(asList(property), vcard.getExtendedProperties());
RawProperty property2 = vcard.setExtendedProperty("NAME", "value", VCardDataType.TEXT);
assertEquals("NAME", property2.getPropertyName());
assertEquals("value", property2.getValue());
assertEquals(VCardDataType.TEXT, property2.getDataType());
assertEquals(asList(property2), vcard.getExtendedProperties());
}
use of ezvcard.property.RawProperty in project ez-vcard by mangstadt.
the class VCardTest method addExtendedProperty.
@Test
public void addExtendedProperty() {
VCard vcard = new VCard();
assertEquals(asList(), vcard.getExtendedProperties());
RawProperty property = vcard.addExtendedProperty("NAME", "value");
assertEquals("NAME", property.getPropertyName());
assertEquals("value", property.getValue());
assertNull(property.getDataType());
assertEquals(asList(property), vcard.getExtendedProperties());
RawProperty property2 = vcard.addExtendedProperty("NAME", "value", VCardDataType.TEXT);
assertEquals("NAME", property2.getPropertyName());
assertEquals("value", property2.getValue());
assertEquals(VCardDataType.TEXT, property2.getDataType());
assertEquals(asList(property, property2), vcard.getExtendedProperties());
}
use of ezvcard.property.RawProperty in project ez-vcard by mangstadt.
the class VCardTest method getExtendedProperty.
@Test
public void getExtendedProperty() {
VCard vcard = new VCard();
assertNull(vcard.getExtendedProperty("NAME"));
vcard.addExtendedProperty("NAME2", "value");
assertNull(vcard.getExtendedProperty("NAME"));
RawProperty property = vcard.addExtendedProperty("NAME", "value");
assertEquals(property, vcard.getExtendedProperty("NAME"));
assertEquals(property, vcard.getExtendedProperty("name"));
vcard.addExtendedProperty("NAME", "value2");
assertEquals(property, vcard.getExtendedProperty("NAME"));
}
Aggregations