public final class Address extends SlingAdaptable implements Comparable<Address>
AddressManager
to create address objects.Modifier and Type | Field and Description |
---|---|
static String |
CITY
Property describing the address city.
|
static String |
COUNTRY
Property describing the country.
|
static String |
FIRST_NAME
Property describing the address first name.
|
static String |
LABEL
Property describing the address label.
|
static String |
LAST_NAME
Property describing the address last name.
|
static String |
PARAM_ADDRESS_PATH
Address path parameter name.
|
static String |
STATE
Property describing the state (mainly used in the U.S.)
|
static String |
STREET_LINE1
Property describing the 1st line of the address street.
|
static String |
STREET_LINE2
Property describing the 2nd line of the address street.
|
static String |
TITLE
Property describing the address title.
|
static String |
ZIP_CODE
Property describing the zip code.
|
Constructor and Description |
---|
Address(Resource res)
Creates an address object.
|
Modifier and Type | Method and Description |
---|---|
<AdapterType> |
adaptTo(Class<AdapterType> type) |
int |
compareTo(Address address)
Compares the current address with another one for sorting.
|
String |
getCity()
Returns the address city.
|
String |
getCountry()
Returns the address country.
|
String |
getFirstName()
Returns the address first name.
|
String |
getLabel()
Returns the address label.
|
String |
getLastName()
Returns the address last name.
|
String |
getPath()
Returns the address path in the repository.
|
ValueMap |
getProperties()
Returns the address properties.
|
<T> T |
getProperty(String key,
Class<T> type)
Returns a named address property converted to a given type.
|
<T> T |
getProperty(String key,
T defaultValue)
Returns a named address property or a default value if the property can not be retrieved.
|
String |
getState()
Returns the address state.
|
String |
getStreetLine1()
Returns the 1st line of the address street.
|
String |
getStreetLine2()
Returns the 2nd line of the address street.
|
String |
getTitle()
Returns the address title.
|
String |
getZipCode()
Returns the address zip code.
|
void |
setCity(String city)
Sets the address city.
|
void |
setCountry(String country)
Sets the address country.
|
void |
setFirstName(String firstName)
Sets the address first name.
|
void |
setLabel(String label)
Sets the address label.
|
void |
setLastName(String lastName)
Sets the address last name.
|
void |
setProperties(Map<String,Object> properties)
Sets the address properties.
|
void |
setProperty(String key,
Object value)
Sets an address property.
|
void |
setState(String state)
Sets the address state.
|
void |
setStreetLine1(String streetLine1)
Sets the 1st line of the address street.
|
void |
setStreetLine2(String streetLine1)
Sets the 2nd line of the address street.
|
void |
setTitle(String title)
Sets the address title.
|
void |
setZipCode(String zipCode)
Sets the address zip code.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compareTo
public static final String LABEL
public static final String TITLE
public static final String FIRST_NAME
public static final String LAST_NAME
public static final String STREET_LINE1
public static final String STREET_LINE2
public static final String CITY
public static final String ZIP_CODE
public static final String STATE
public static final String COUNTRY
public static final String PARAM_ADDRESS_PATH
public Address(Resource res)
res
- The resource that represents the address.public String getPath()
public ValueMap getProperties()
ValueMap
.public <T> T getProperty(String key, Class<T> type)
key
- The name of the propertytype
- The type to which the property should be converted.public <T> T getProperty(String key, T defaultValue)
key
- The name of the propertydefaultValue
- The default value to use if the named property does
not exist or cannot be converted to the requested type. The
default value is also used to define the type to convert the
value to. If this is null
any existing property is
not converted.public void setProperties(Map<String,Object> properties) throws AddressException
properties
- The new address properties.AddressException
- if persisting the properties fails.public void setProperty(String key, Object value) throws AddressException
key
- The name of the propertyvalue
- The value of the propertyAddressException
- if persisting the property fails.public String getLabel()
public void setLabel(String label) throws AddressException
AddressException
public String getTitle()
public void setTitle(String title) throws AddressException
AddressException
public String getFirstName()
public void setFirstName(String firstName) throws AddressException
AddressException
public String getLastName()
public void setLastName(String lastName) throws AddressException
AddressException
public String getStreetLine1()
public void setStreetLine1(String streetLine1) throws AddressException
AddressException
public String getStreetLine2()
public void setStreetLine2(String streetLine1) throws AddressException
AddressException
public String getCity()
public void setCity(String city) throws AddressException
AddressException
public String getZipCode()
public void setZipCode(String zipCode) throws AddressException
AddressException
public String getState()
public void setState(String state) throws AddressException
AddressException
public String getCountry()
public void setCountry(String country) throws AddressException
AddressException
public int compareTo(Address address)
address
- The address which has to be compared with the current oneComparable.compareTo(Object)
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"