Java tutorial
/* * Copyright (C) 2014 Brian Lee * * 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 AddressComponent extends JsonModel implements Parcelable { @JsonProperty(LONG_NAME) private String longName; @JsonProperty(SHORT_NAME) private String shortName; @JsonProperty(TYPES) private List<PlaceType> addressTypes; public AddressComponent() { // required for Jackson } @SuppressWarnings("unchecked") public AddressComponent(Parcel in) { longName = in.readString(); shortName = in.readString(); addressTypes = in.readArrayList(PlaceType.class.getClassLoader()); } public String getLongName() { return longName; } public String getShortName() { return shortName; } public List<PlaceType> getAddressTypes() { return addressTypes; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(longName); dest.writeString(shortName); dest.writeList(addressTypes); } public static final Creator<AddressComponent> CREATOR = new Creator<AddressComponent>() { @Override public AddressComponent createFromParcel(Parcel source) { return new AddressComponent(source); } @Override public AddressComponent[] newArray(int size) { return new AddressComponent[size]; } }; }