Back to project page AndroidPlaces.
The source code is released under:
Apache License
If you think the Android project AndroidPlaces listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (C) 2014 Brian Lee/*w w w . j a v a 2 s . c o m*/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tigerpenguin.places.model; import android.os.Parcel; import android.os.Parcelable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; public class Place extends JsonModel implements Parcelable { @JsonProperty(PLACE_ID) private String placeId; @JsonProperty(NAME) private String name; @JsonProperty(VICINITY) private String vicinity; @JsonProperty(FORMATTED_ADDRESS) private String formattedAddress; @JsonProperty(PRICE_LEVEL) private PriceLevel priceLevel; @JsonProperty(RATING) private double rating; @JsonProperty(ICON) private String iconUrl; @JsonProperty(TYPES) private List<PlaceType> types; @JsonProperty(GEOMETRY) private Geometry geometry; @JsonProperty(OPENING_HOURS) private OpeningHours openingHours; @JsonProperty(PHOTOS) private List<Photo> photos; public Place() { // required for Jackson } @SuppressWarnings("unchecked") public Place(Parcel in) { placeId = in.readString(); name = in.readString(); vicinity = in.readString(); formattedAddress = in.readString(); priceLevel = (PriceLevel) in.readSerializable(); rating = in.readDouble(); iconUrl = in.readString(); types = in.readArrayList(PlaceType.class.getClassLoader()); geometry = in.readParcelable(Geometry.class.getClassLoader()); openingHours = in.readParcelable(OpeningHours.class.getClassLoader()); photos = in.readArrayList(Photo.class.getClassLoader()); } public String getName() { return name; } public double getRating() { return rating; } public boolean hasRating() { return rating > 0d; } public PlaceLocation getLocation() { PlaceLocation location = null; if (geometry != null) { location = geometry.getLocation(); } return location; } public String getPlaceId() { return placeId; } public String getVicinity() { return vicinity; } public String getFormattedAddress() { return formattedAddress; } public PriceLevel getPriceLevel() { return priceLevel; } public boolean hasPriceLevel() { return priceLevel != null; } public String getIconUrl() { return iconUrl; } public List<PlaceType> getTypes() { return types; } public OpeningHours getOpeningHours() { return openingHours; } public List<Photo> getPhotos() { return photos; } public boolean hasPhotos() { return photos != null && photos.size() > 0; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(placeId); dest.writeString(name); dest.writeString(vicinity); dest.writeString(formattedAddress); dest.writeSerializable(priceLevel); dest.writeDouble(rating); dest.writeString(iconUrl); dest.writeList(types); dest.writeParcelable(geometry, flags); dest.writeParcelable(openingHours, flags); dest.writeList(photos); } public static final Creator<Place> CREATOR = new Creator<Place>() { @Override public Place createFromParcel(Parcel source) { return new Place(source); } @Override public Place[] newArray(int size) { return new Place[size]; } }; }