corny.addressbook.data
Enum ContactProperty

java.lang.Object
  extended by java.lang.Enum<ContactProperty>
      extended by corny.addressbook.data.ContactProperty
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ContactProperty>

public enum ContactProperty
extends java.lang.Enum<ContactProperty>

Enumeration declaring the properties a Contact can have.

This enumeration provides a generic access to Contact properties. Each ContactProperty contains a method to get the corresponding value from a Contact. The modifiable properties also offer a method to set the corresponding value.

For the filter creation process, the properties also contain regular expression representations.

Author:
Corny

Enum Constant Summary
ADDRESS_CITY
          Multi value, String type
ADDRESS_COUNTRY
          Multi value, String type
ADDRESS_COUNTRY_CODE
          Multi value, String type
ADDRESS_STREET
          Multi value, String type
ADDRESS_ZIP
          Multi value, Integer type / String type
AGE
          Integer type / String type
BIRTHDAY
          java.util.Date type / String type
CHAT
          Multi value, String type
CONTACT
          corny.data.Contact type Can be used with the Comparison ContactFilter.IN_GROUP.
CREATION_DATE
          java.util.Date type / String type
DISPLAYED_NAME
          String type
EMAIL
          Multi value, String type
FIRST_NAME
          String type
FULL_ADDRESS
          Multi value, corny.addressbook.data.Address type / String type
FULL_NAME
          String type
FULL_NAME_LAST_NAME_FIRST
          String type
FULL_TEXT
          String type
HAS_PICTURE
          Boolean type
IS_ORGANIZATION
          Boolean type
IS_PERSON
          Boolean type
LAST_NAME
          String type
MIDDLE_NAME
          String type
MODIFICATION_DATE
          java.util.Date type / String type
ORGANIZATION
          String type
PARENT_GROUP_NAME
          String type
PARENT_GROUPS
          Group class
PHONE
          Multi value, String type
TITLE
          String type
UID
          String type
 
Method Summary
 void addRegularExpressionsTo(java.util.Map<java.lang.String,ContactProperty> propertyMap)
          Used by the FilterCreator process to read the regular expressions which represent this property.
 java.util.List<java.lang.Object> fetchContactInfo(Contact c, java.lang.String propertyLabel, java.lang.Class<?> preferredClass)
          Used by the filtering process.
 java.util.List<java.lang.Class<?>> getClasses()
          Returns the Classes to which the property can be converted.
abstract  java.lang.String getDefaultRegex()
          Returns the default regular expression used in the SearchDialog.
 java.lang.String getHumanReadableName()
          Returns the human readable, localized name of this property.
 java.lang.Object getValue(Contact c)
          Returns the value of this property for a given Contact instance.
abstract  java.lang.Object getValue(Contact c, java.lang.String label)
          Returns the value of this property for a given Contact instance.
 boolean isModifiable()
          Returns true if the property can be modified.
 boolean isMultiValue()
          Returns true, if the property is a multi value property.
 boolean isStringClass()
          Returns true if the property can be converted to a String
 boolean modifyContactInfo(Contact c, java.lang.String propertyLabel, ValueModifier modifier)
          Used by the search and replace process.
 boolean setValue(Contact c, java.lang.Object value)
          Sets the value of this property for a given Contact instance.
static ContactProperty valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ContactProperty[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CONTACT

public static final ContactProperty CONTACT
corny.data.Contact type

Can be used with the Comparison ContactFilter.IN_GROUP.


FULL_TEXT

public static final ContactProperty FULL_TEXT
String type


TITLE

public static final ContactProperty TITLE
String type


FIRST_NAME

public static final ContactProperty FIRST_NAME
String type


MIDDLE_NAME

public static final ContactProperty MIDDLE_NAME
String type


LAST_NAME

public static final ContactProperty LAST_NAME
String type


FULL_NAME

public static final ContactProperty FULL_NAME
String type


FULL_NAME_LAST_NAME_FIRST

public static final ContactProperty FULL_NAME_LAST_NAME_FIRST
String type


ORGANIZATION

public static final ContactProperty ORGANIZATION
String type


DISPLAYED_NAME

public static final ContactProperty DISPLAYED_NAME
String type


BIRTHDAY

public static final ContactProperty BIRTHDAY
java.util.Date type / String type


AGE

public static final ContactProperty AGE
Integer type / String type


PHONE

public static final ContactProperty PHONE
Multi value, String type


EMAIL

public static final ContactProperty EMAIL
Multi value, String type


CHAT

public static final ContactProperty CHAT
Multi value, String type


FULL_ADDRESS

public static final ContactProperty FULL_ADDRESS
Multi value, corny.addressbook.data.Address type / String type


ADDRESS_STREET

public static final ContactProperty ADDRESS_STREET
Multi value, String type


ADDRESS_ZIP

public static final ContactProperty ADDRESS_ZIP
Multi value, Integer type / String type


ADDRESS_CITY

public static final ContactProperty ADDRESS_CITY
Multi value, String type


ADDRESS_COUNTRY_CODE

public static final ContactProperty ADDRESS_COUNTRY_CODE
Multi value, String type


ADDRESS_COUNTRY

public static final ContactProperty ADDRESS_COUNTRY
Multi value, String type


PARENT_GROUP_NAME

public static final ContactProperty PARENT_GROUP_NAME
String type


PARENT_GROUPS

public static final ContactProperty PARENT_GROUPS
Group class


IS_PERSON

public static final ContactProperty IS_PERSON
Boolean type


IS_ORGANIZATION

public static final ContactProperty IS_ORGANIZATION
Boolean type


CREATION_DATE

public static final ContactProperty CREATION_DATE
java.util.Date type / String type


MODIFICATION_DATE

public static final ContactProperty MODIFICATION_DATE
java.util.Date type / String type


HAS_PICTURE

public static final ContactProperty HAS_PICTURE
Boolean type


UID

public static final ContactProperty UID
String type

Method Detail

values

public static ContactProperty[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ContactProperty c : ContactProperty.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ContactProperty valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getHumanReadableName

public java.lang.String getHumanReadableName()
Returns the human readable, localized name of this property.

Returns:
Human readable name

getDefaultRegex

public abstract java.lang.String getDefaultRegex()
Returns the default regular expression used in the SearchDialog.

Returns:
Default regular expression

getClasses

public java.util.List<java.lang.Class<?>> getClasses()
Returns the Classes to which the property can be converted.

Returns:
Possible Classes

isStringClass

public boolean isStringClass()
Returns true if the property can be converted to a String

Returns:
True, if the property can be converted to a String

isMultiValue

public boolean isMultiValue()
Returns true, if the property is a multi value property.

Returns:
true, if the property is a multi value property.

isModifiable

public boolean isModifiable()
Returns true if the property can be modified. Some aggregated properties, like FULL_TEXT or AGE cannot be modified.

Returns:
true if the property can be modified

fetchContactInfo

public java.util.List<java.lang.Object> fetchContactInfo(Contact c,
                                                         java.lang.String propertyLabel,
                                                         java.lang.Class<?> preferredClass)
Used by the filtering process. Fetches the values for this property from a given Contact and writes them into a List.

Parameters:
c - Contact to read property from
propertyLabel - Specific label to read for a multi value property or null to read every label
preferredClass - Preferred Class
Returns:
List of values

getValue

public abstract java.lang.Object getValue(Contact c,
                                          java.lang.String label)
Returns the value of this property for a given Contact instance.

Parameters:
c - Contact
label - Specific label for a multi value property or null to get every label
Returns:
Value of this property or null if no value exists.

getValue

public final java.lang.Object getValue(Contact c)
Returns the value of this property for a given Contact instance.

Parameters:
c - Contact
Returns:
Value of this property or null if no value exists.

setValue

public final boolean setValue(Contact c,
                              java.lang.Object value)
Sets the value of this property for a given Contact instance.

Parameters:
c - Contact
value - New value (see getValue(Contact) for the required type)
Returns:
True, if the value is now equal to the given value.

modifyContactInfo

public boolean modifyContactInfo(Contact c,
                                 java.lang.String propertyLabel,
                                 ValueModifier modifier)
Used by the search and replace process. Modifies the value of a property of a given Contact by using the given ValueModifier.

Parameters:
c - Contact to modify
propertyLabel - Specific label to modify for a multi value property or null to modify every label
modifier - ValueModifier
Returns:
true, if something was modified

addRegularExpressionsTo

public final void addRegularExpressionsTo(java.util.Map<java.lang.String,ContactProperty> propertyMap)
Used by the FilterCreator process to read the regular expressions which represent this property.

Parameters:
propertyMap - Map to write the expressions to