private static <T extends VCardProperty> List<T> getPropertiesWithPreference( VCard vCard, Class<T> clazz, int preference) { return vCard .getProperties(clazz) .stream() .filter(p -> p.getParameter(VCardParameters.PREF).equals(Integer.toString(preference))) .collect(Collectors.toList()); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; ListProperty<?> other = (ListProperty<?>) obj; if (!values.equals(other.values)) return false; return true; } }
if (!isSupportedBy(version)) { warnings.add(new ValidationWarning(2, Arrays.toString(getSupportedVersions()))); _validate(warnings, version, vcard);
@Override public List<Pid> getPids() { return super.getPids(); }
@Override public Integer getPref() { return super.getPref(); }
propertiesByGroup.put(property.getGroup(), property);
@Override public String getLanguage() { return super.getLanguage(); }
/** * Sorts by PREF parameter ascending. Properties that do not have a PREF * parameter are pushed to the end of the list. */ public int compareTo(VCardProperty that) { Integer pref0 = this.getParameters().getPref(); Integer pref1 = that.getParameters().getPref(); if (pref0 == null && pref1 == null) { return 0; } if (pref0 == null) { return 1; } if (pref1 == null) { return -1; } return pref1.compareTo(pref0); }
/** * <p> * Determines if this property is supported by the given vCard version. * </p> * <p> * The supported versions are defined by assigning a * {@link SupportedVersions} annotation to the property class. Property * classes without this annotation are considered to be supported by all * versions. * </p> * @param version the vCard version * @return true if it is supported, false if not */ public final boolean isSupportedBy(VCardVersion version) { VCardVersion supportedVersions[] = getSupportedVersions(); for (VCardVersion supportedVersion : supportedVersions) { if (supportedVersion == version) { return true; } } return false; }
/** * Creates a deep copy of the given vCard. * @param original the vCard to copy */ public VCard(VCard original) { version = original.version; for (VCardProperty property : original.getProperties()) { addProperty(property.copy()); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; SimpleProperty<?> other = (SimpleProperty<?>) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) return false; return true; } }
@Override public List<Pid> getPids() { return super.getPids(); }
@Override public Integer getPref() { return super.getPref(); }
propertiesByGroup.put(property.getGroup(), property);
@Override public String getLanguage() { return super.getLanguage(); }
/** * Sanitizes a property's parameters (called before the property is * written). Note that a copy of the parameters is returned so that the * property object does not get modified. * @param property the property * @param version the version of the vCard that is being generated * @param vcard the vCard that the property belongs to * @return the sanitized parameters */ public final VCardParameters prepareParameters(T property, VCardVersion version, VCard vcard) { //make a copy because the property should not get modified when it is marshalled VCardParameters copy = new VCardParameters(property.getParameters()); _prepareParameters(property, copy, version, vcard); return copy; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; Impp other = (Impp) obj; if (uri == null) { if (other.uri != null) return false; } else if (!uri.equals(other.uri)) return false; return true; } }
@Override public List<Pid> getPids() { return super.getPids(); }
@Override public Integer getPref() { return super.getPref(); }
if (targetVersion == VCardVersion.V2_1) { writer.writeProperty(property.getGroup(), scribe.getPropertyName(), new VObjectParameters(parameters.getMap()), value); prodIdStack.add(addProdId); addProdId = false; writer.writeProperty(property.getGroup(), scribe.getPropertyName(), new VObjectParameters(parameters.getMap()), vcardStr);