Modifier and Type | Field and Description |
---|---|
static String |
FIND_ALL
|
static String |
FIND_BY_NAME
Specifies the
String that represents the NamedQuery to create a TypedQuery to get all
places by name. |
Constructor and Description |
---|
Place()
No-argument constructor for JPA.
|
Place(String name)
Creates a new place with the specified name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getId()
Return the unique identifier or primary key of the place.
|
abstract String |
getLink()
Returns a URL String, typically either a Google query or Google map link.
|
String |
getName()
Returns the name of the place.
|
List<Place> |
getPlaces()
Returns a list containing this place and all regions it is in.
|
Place |
getRegion()
Return the region of the place.
|
int |
hashCode() |
Iterator<Place> |
iterator()
Returns an iterator containing this place and all regions it is in.
|
void |
setId(int id)
Sets the unique identifier or primary key of the place.
|
void |
setName(String name)
Sets the name of the place.
|
void |
setRegion(Place region)
Sets the region of the place.
|
String |
toString()
Returns a string representation of the place.
|
forEach, spliterator
public static final String FIND_ALL
String
that represents the NamedQuery
to create a TypedQuery
to get all
places.
For example:
TypedQuery<Place> query = em.createNamedQuery(Place.FIND_ALL, Place.class);
public static final String FIND_BY_NAME
String
that represents the NamedQuery
to create a TypedQuery
to get all
places by name.
For example:
TypedQuery<Place> query = em.createNamedQuery(Place.FIND_BY_NAME, Place.class); query.setParameter("name", name);
public Place()
public Place(String name)
name
- the name of the placepublic int getId()
public void setId(int id)
id
- the unique identifierpublic String getName()
public void setName(String name)
name
- the name of the placepublic Place getRegion()
Cemetery
→ City
→ County
→ State
→ Country
. A
City
's region does not have to be a County
, it could also be a State
or Country
.public void setRegion(Place region)
Cemetery
→ City
→ County
→ State
→ Country
. A
City
's region does not have to be a County
, it could also be a State
or Country
.region
- the region of the placepublic List<Place> getPlaces()
public Iterator<Place> iterator()
getPlaces()
.public abstract String getLink()
"https://www.google.com/search?q="
while a Google map link follows the format "https://www.google.com/maps/place/"
.public String toString()
toString
in class Object
getName()
,
getRegion()
Copyright © 2015 Joseph Hendrix