public final class Location extends SlingAdaptable
LocationManager
to access location objects.Modifier and Type | Field and Description |
---|---|
static String |
HOURS |
static String |
LATITUDE |
static String |
LONGITUDE |
static String |
PHONE |
Constructor and Description |
---|
Location(Resource resource)
Creates a location object.
|
Modifier and Type | Method and Description |
---|---|
<AdapterType> |
adaptTo(Class<AdapterType> type)
Calls into the registered
AdapterManager to adapt this object to
the desired type . |
boolean |
equals(Object obj) |
Coordinates |
getCoordinates()
Returns coordinates for this location if latitude and longitude are both available.
|
String |
getDescription()
Return the description of this location as entered by the user.
|
String |
getFullAddress()
The full string representation of a location using the default set of fields
* @return full address string
|
String |
getFullAddress(String[] fields)
The full string representation of a location using the provided array of property names.
|
String[] |
getHours()
Returns the location hours, or null, if no hours property exists.
|
String |
getPath()
Returns the location path in the repository.
|
String |
getPhone()
Returns the location phone number.
|
String |
getTitle()
Returns the title of this location as entered by the user.
|
int |
hashCode() |
void |
setCoordinates(Coordinates coord)
Sets the location coordinate properties.
|
void |
setHours(String[] hours)
Sets the location hours.
|
void |
setPhone(String phone)
Sets the location phone number.
|
setAdapterManager, unsetAdapterManager
public static final String LATITUDE
public static final String LONGITUDE
public static final String PHONE
public static final String HOURS
public Location(Resource resource)
resource
- The resource representing a location.IllegalArgumentException
- when Resource is null
public String getPath()
public String getTitle()
null
if not defined.public String getDescription()
null
if not defined.public void setCoordinates(Coordinates coord) throws AddressException
coord
- The new location properties.AddressException
- if persisting the coordinates fails.public Coordinates getCoordinates()
null
if not definedpublic String getPhone()
public void setPhone(String phone) throws AddressException
AddressException
public String[] getHours()
public void setHours(String[] hours) throws AddressException
AddressException
public String getFullAddress()
public String getFullAddress(String[] fields)
fields
- Property names to usepublic <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
SlingAdaptable
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 Adaptable
adaptTo
in class SlingAdaptable
AdapterType
- 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.class
null
if the resource cannot
adapt to the requested type"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"