public final class Address extends SlingAdaptable implements java.lang.Comparable<Address>
AddressManager to create address objects.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CITY
Property describing the address city.
|
static java.lang.String |
COUNTRY
Property describing the country.
|
static java.lang.String |
FIRST_NAME
Property describing the address first name.
|
static java.lang.String |
LABEL
Property describing the address label.
|
static java.lang.String |
LAST_NAME
Property describing the address last name.
|
static java.lang.String |
PARAM_ADDRESS_PATH
Address path parameter name.
|
static java.lang.String |
STATE
Property describing the state (mainly used in the U.S.)
|
static java.lang.String |
STREET_LINE1
Property describing the 1st line of the address street.
|
static java.lang.String |
STREET_LINE2
Property describing the 2nd line of the address street.
|
static java.lang.String |
TITLE
Property describing the address title.
|
static java.lang.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(java.lang.Class<AdapterType> type)
Calls into the registered
AdapterManager to adapt this object to
the desired type. |
int |
compareTo(Address address)
Compares the current address with another one for sorting.
|
java.lang.String |
getCity()
Returns the address city.
|
java.lang.String |
getCountry()
Returns the address country.
|
java.lang.String |
getFirstName()
Returns the address first name.
|
java.lang.String |
getLabel()
Returns the address label.
|
java.lang.String |
getLastName()
Returns the address last name.
|
java.lang.String |
getPath()
Returns the address path in the repository.
|
ValueMap |
getProperties()
Returns the address properties.
|
<T> T |
getProperty(java.lang.String key,
java.lang.Class<T> type)
Returns a named address property converted to a given type.
|
<T> T |
getProperty(java.lang.String key,
T defaultValue)
Returns a named address property or a default value if the property can not be retrieved.
|
java.lang.String |
getState()
Returns the address state.
|
java.lang.String |
getStreetLine1()
Returns the 1st line of the address street.
|
java.lang.String |
getStreetLine2()
Returns the 2nd line of the address street.
|
java.lang.String |
getTitle()
Returns the address title.
|
java.lang.String |
getZipCode()
Returns the address zip code.
|
void |
setCity(java.lang.String city)
Sets the address city.
|
void |
setCountry(java.lang.String country)
Sets the address country.
|
void |
setFirstName(java.lang.String firstName)
Sets the address first name.
|
void |
setLabel(java.lang.String label)
Sets the address label.
|
void |
setLastName(java.lang.String lastName)
Sets the address last name.
|
void |
setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
Sets the address properties.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets an address property.
|
void |
setState(java.lang.String state)
Sets the address state.
|
void |
setStreetLine1(java.lang.String streetLine1)
Sets the 1st line of the address street.
|
void |
setStreetLine2(java.lang.String streetLine1)
Sets the 2nd line of the address street.
|
void |
setTitle(java.lang.String title)
Sets the address title.
|
void |
setZipCode(java.lang.String zipCode)
Sets the address zip code.
|
setAdapterManager, unsetAdapterManagerpublic static final java.lang.String LABEL
public static final java.lang.String TITLE
public static final java.lang.String FIRST_NAME
public static final java.lang.String LAST_NAME
public static final java.lang.String STREET_LINE1
public static final java.lang.String STREET_LINE2
public static final java.lang.String CITY
public static final java.lang.String ZIP_CODE
public static final java.lang.String STATE
public static final java.lang.String COUNTRY
public static final java.lang.String PARAM_ADDRESS_PATH
public Address(Resource res)
res - The resource that represents the address.public java.lang.String getPath()
public ValueMap getProperties()
ValueMap.public <T> T getProperty(java.lang.String key,
java.lang.Class<T> type)
key - The name of the propertytype - The type to which the property should be converted.public <T> T getProperty(java.lang.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(java.util.Map<java.lang.String,java.lang.Object> properties)
throws AddressException
properties - The new address properties.AddressException - if persisting the properties fails.public void setProperty(java.lang.String key,
java.lang.Object value)
throws AddressException
key - The name of the propertyvalue - The value of the propertyAddressException - if persisting the property fails.public java.lang.String getLabel()
public void setLabel(java.lang.String label)
throws AddressException
AddressExceptionpublic java.lang.String getTitle()
public void setTitle(java.lang.String title)
throws AddressException
AddressExceptionpublic java.lang.String getFirstName()
public void setFirstName(java.lang.String firstName)
throws AddressException
AddressExceptionpublic java.lang.String getLastName()
public void setLastName(java.lang.String lastName)
throws AddressException
AddressExceptionpublic java.lang.String getStreetLine1()
public void setStreetLine1(java.lang.String streetLine1)
throws AddressException
AddressExceptionpublic java.lang.String getStreetLine2()
public void setStreetLine2(java.lang.String streetLine1)
throws AddressException
AddressExceptionpublic java.lang.String getCity()
public void setCity(java.lang.String city)
throws AddressException
AddressExceptionpublic java.lang.String getZipCode()
public void setZipCode(java.lang.String zipCode)
throws AddressException
AddressExceptionpublic java.lang.String getState()
public void setState(java.lang.String state)
throws AddressException
AddressExceptionpublic java.lang.String getCountry()
public void setCountry(java.lang.String country)
throws AddressException
AddressExceptionpublic int compareTo(Address address)
compareTo in interface java.lang.Comparable<Address>address - The address which has to be compared with the current oneComparable.compareTo(Object)public <AdapterType> AdapterType adaptTo(java.lang.Class<AdapterType> type)
AdapterManager to adapt this object to
the desired type.
This method implements a cache of adapters to improve performance. That is repeated calls to this method with the same class will result in the same object to be returned.
adaptTo in interface AdaptableadaptTo in class SlingAdaptableAdapterType - The generic type to which this resource is adapted
totype - The Class object of the target type, such as
javax.jcr.Node.class or
java.io.File.classnull if the resource cannot
adapt to the requested type"Copyright © 2010 - 2018 Adobe Systems Incorporated. All Rights Reserved"