/** * {@inheritDoc} */ public Kind createProperty(final List<Parameter> params, final String value) { return new Kind(params, value); }
/** * {@inheritDoc} */ @Override public void validate() throws ValidationException { // ; No parameters allowed assertParametersEmpty(); }
/** * @throws ValidationException where validation fails */ public void validate() throws ValidationException { // ;A vCard object MUST include the VERSION and FN properties. assertOne(Property.Id.VERSION); assertOne(Property.Id.FN); //assertOne(Property.Id.N); boolean isKindGroup = false; final List<Property> properties = getProperties(Id.KIND); if (properties.size() > 1) { throw new ValidationException("Property [" + Id.KIND + "] must be specified zero or once"); } else if (properties.size() == 1) { isKindGroup = properties.iterator().next().getValue().equals(Kind.GROUP.getValue()); } for (Property property : getProperties()) { if (!isKindGroup && (property.getId().equals(Id.MEMBER))) { throw new ValidationException("Property [" + Id.MEMBER + "] can only be specified if the KIND property value is \"group\"."); } property.validate(); } }
/** * @throws ValidationException where validation fails */ public void validate() throws ValidationException { // ;A vCard object MUST include the VERSION and FN properties. assertOne(Property.Id.VERSION); assertOne(Property.Id.FN); //assertOne(Property.Id.N); boolean isKindGroup = false; final List<Property> properties = getProperties(Id.KIND); if (properties.size() > 1) { throw new ValidationException("Property [" + Id.KIND + "] must be specified zero or once"); } else if (properties.size() == 1) { isKindGroup = properties.iterator().next().getValue().equals(Kind.GROUP.getValue()); } for (Property property : getProperties()) { if (!isKindGroup && (property.getId().equals(Id.MEMBER))) { throw new ValidationException("Property [" + Id.MEMBER + "] can only be specified if the KIND property value is \"group\"."); } property.validate(); } }
setKind(Kind.GROUP.getValue());
/** * {@inheritDoc} */ @Override public void validate() throws ValidationException { // ; No parameters allowed assertParametersEmpty(); }
/** * {@inheritDoc} */ public Kind createProperty(final List<Parameter> params, final String value) { return new Kind(params, value); }