/**
* Create a new EmailFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, which should be a valid, non-empty
+ * e-mail address
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to an
* empty map of parameters.
*
- *
* @return a new EmailFieldDetails
*
* @since 0.6.0
public EmailFieldDetails (string value,
MultiMap<string, string>? parameters = null)
{
+ if (value == "")
+ {
+ warning ("Empty e-mail address passed to EmailFieldDetails.");
+ }
+
this.value = value;
if (parameters != null)
this.parameters = parameters;
/**
* Create a new ImFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, which should be a valid, non-empty
+ * IM address
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to an
* empty map of parameters.
public ImFieldDetails (string value,
MultiMap<string, string>? parameters = null)
{
+ if (value == "")
+ {
+ warning ("Empty IM address passed to ImFieldDetails.");
+ }
+
this.value = value;
if (parameters != null)
this.parameters = parameters;
/**
* Create a new NoteFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, which should be a non-empty free-form
+ * UTF-8 string as entered by the user
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to a
* empty map of parameters.
MultiMap<string, string>? parameters = null,
string? uid = null)
{
+ if (value == "")
+ {
+ warning ("Empty note passed to NoteFieldDetails.");
+ }
+
Object (value: value,
id: uid,
parameters: parameters);
/**
* Create a new PhoneFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, which should be a non-empty phone
+ * number (no particular format is mandated)
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to a
* empty map of parameters.
public PhoneFieldDetails (string value,
MultiMap<string, string>? parameters = null)
{
+ if (value == "")
+ {
+ warning ("Empty phone number passed to PhoneFieldDetails.");
+ }
+
Object (value: value,
parameters: parameters);
}
}
/**
+ * Whether none of the components is set.
+ *
+ * @return `true` if all the components are the empty string, `false`
+ * otherwise.
+ *
+ * @since UNRELEASED
+ */
+ public bool is_empty ()
+ {
+ return this.po_box == "" &&
+ this.extension == "" &&
+ this.street == "" &&
+ this.locality == "" &&
+ this.region == "" &&
+ this.postal_code == "" &&
+ this.country == "" &&
+ this.address_format == "";
+ }
+
+ /**
* Compare if two postal addresses are equal. Addresses are equal if all their
* components are equal (where `null` compares equal only with `null`) and
* they have the same set of types (or both have no types).
/**
* Create a new PostalAddressFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, a non-empty {@link PostalAddress}
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to an
* empty map of parameters.
public PostalAddressFieldDetails (PostalAddress value,
MultiMap<string, string>? parameters = null)
{
+ if (value.is_empty ())
+ {
+ warning ("Empty postal address passed to PostalAddressFieldDetails.");
+ }
+
/* We keep id and value.uid synchronised in both directions. */
Object (value: value,
parameters: parameters,
}
/**
+ * Whether none of the components is set.
+ *
+ * @return `true` if all the components are the empty string, `false`
+ * otherwise.
+ *
+ * @since UNRELEASED
+ */
+ public bool is_empty ()
+ {
+ return this.organisation_name == "" &&
+ this.title == "" &&
+ this.role == "";
+ }
+
+ /**
* Compare if two roles are equal. Roles are equal if their titles and
* organisation names are equal.
*
/**
* Create a new RoleFieldDetails.
*
- * @param value the {@link Role} of the field
+ * @param value the non-empty {@link Role} of the field
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to an
* empty map of parameters.
public RoleFieldDetails (Role value,
MultiMap<string, string>? parameters = null)
{
+ if (value.is_empty ())
+ {
+ warning ("Empty role passed to RoleFieldDetails.");
+ }
+
/* We keep id and value.uid synchronised in both directions. */
Object (value: value,
parameters: parameters,
/**
* Create a new UrlFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, a non-empty URI
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to a
* empty map of parameters.
public UrlFieldDetails (string value,
MultiMap<string, string>? parameters = null)
{
+ if (value == "")
+ {
+ warning ("Empty URI passed to UrlFieldDetails.");
+ }
+
Object (value: value,
parameters: parameters);
}
/**
* Create a new WebServiceFieldDetails.
*
- * @param value the value of the field
+ * @param value the value of the field, a non-empty web service address
* @param parameters initial parameters. See
* {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to an
* empty map of parameters.
public WebServiceFieldDetails (string value,
MultiMap<string, string>? parameters = null)
{
+ if (value == "")
+ {
+ warning ("Empty web service address passed to " +
+ "WebServiceFieldDetails.");
+ }
+
Object (value: value,
parameters: parameters);
}