corny.addressbook.data
Class Address

java.lang.Object
  extended by corny.addressbook.data.Address
All Implemented Interfaces:
IgnoreCaseComparable, Searchable
Direct Known Subclasses:
MutableAddress

public class Address
extends java.lang.Object
implements Searchable, IgnoreCaseComparable

Data model class which represents Address Book Addresses. Contains fields for street, zip, city, country and country code.

Author:
Corny

Field Summary
static int NO_ZIP
          Indicates that no ZIP value was specified.
 
Constructor Summary
Address(java.util.Map<?,?> rawAddress)
          Creates a new Address instance out of the raw data from Apple's Address Book.
Address(java.lang.String street, int zip, java.lang.String city, java.lang.String countryCode, java.lang.String country)
          Creates a new Address instance
 
Method Summary
 void addSearchStringsToList(java.util.List<java.lang.Object> searchObjects, java.lang.String propertyLabel)
          Used by Filter classes to fetch the searchable fields of an object.
 boolean equals(java.lang.Object other)
          Returns true if the instances are the same, if the attributes of the two Address instances are the same or if the String representations are the same.
 boolean equalsIgnoreCase(java.lang.Object other)
          Compares this IgnoreCaseComparable to an Object ignoring case.
 java.lang.String getCity()
           
 java.lang.String getCountry()
           
 java.lang.String getCountryCode()
           
 java.lang.String getStreet()
           
 int getZip()
           
 MutableAddress mutableClone()
          Returns a mutable clone of this Address instance.
 java.util.Map<java.lang.String,java.lang.String> toMap()
           
 java.lang.String toString()
           
 java.lang.String toStringWithLineBreak()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ZIP

public static final int NO_ZIP
Indicates that no ZIP value was specified.

See Also:
Constant Field Values
Constructor Detail

Address

public Address(java.lang.String street,
               int zip,
               java.lang.String city,
               java.lang.String countryCode,
               java.lang.String country)
Creates a new Address instance

Parameters:
street - Street
zip - ZIP. Pass NO_ZIP if you don't want to specify a ZIP value.
city - City
countryCode - Country code
country - Country

Address

public Address(java.util.Map<?,?> rawAddress)
Creates a new Address instance out of the raw data from Apple's Address Book.

Parameters:
rawAddress - Raw address data
Method Detail

getStreet

public java.lang.String getStreet()
Returns:
Street

getZip

public int getZip()
Returns:
Zip code

getCity

public java.lang.String getCity()
Returns:
City

getCountry

public java.lang.String getCountry()
Returns:
Country

getCountryCode

public java.lang.String getCountryCode()
Returns:
Country code

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String representation of the Address

toStringWithLineBreak

public java.lang.String toStringWithLineBreak()
Returns:
String representation of the Address, used for displaying the Address in the ContactDisplayPanel.

toMap

public java.util.Map<java.lang.String,java.lang.String> toMap()
Returns:
Native code compatible Map

addSearchStringsToList

public void addSearchStringsToList(java.util.List<java.lang.Object> searchObjects,
                                   java.lang.String propertyLabel)
Description copied from interface: Searchable
Used by Filter classes to fetch the searchable fields of an object.

Specified by:
addSearchStringsToList in interface Searchable
Parameters:
searchObjects - List to add the searchable fields to
propertyLabel - If this is set, only the properties with a specific label should be added to the list.

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.Object other)
Description copied from interface: IgnoreCaseComparable
Compares this IgnoreCaseComparable to an Object ignoring case.

Specified by:
equalsIgnoreCase in interface IgnoreCaseComparable
Parameters:
other - Object to compare to this instance
Returns:
true, if the given Object equals this instance ignoring case

equals

public boolean equals(java.lang.Object other)
Returns true if the instances are the same, if the attributes of the two Address instances are the same or if the String representations are the same.

Overrides:
equals in class java.lang.Object
Parameters:
other - Other Object
Returns:
True if obj is equal to this

mutableClone

public MutableAddress mutableClone()
Returns a mutable clone of this Address instance.

Returns:
Mutable clone