com.tigerpenguin.places.model.Period.java Source code

Java tutorial

Introduction

Here is the source code for com.tigerpenguin.places.model.Period.java

Source

/*
 * 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;

public class Period extends JsonModel implements Parcelable {

    @JsonProperty(OPEN)
    private DayTime openingTime;

    @JsonProperty(CLOSE)
    private DayTime closingTime;

    public Period() {
        // required for Jackson
    }

    public Period(Parcel in) {
        openingTime = in.readParcelable(DayTime.class.getClassLoader());
        closingTime = in.readParcelable(DayTime.class.getClassLoader());
    }

    public DayTime getOpeningTime() {
        return openingTime;
    }

    public DayTime getClosingTime() {
        return closingTime;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(openingTime, flags);
        dest.writeParcelable(closingTime, flags);
    }

    public static final Creator<Period> CREATOR = new Creator<Period>() {
        @Override
        public Period createFromParcel(Parcel source) {
            return new Period(source);
        }

        @Override
        public Period[] newArray(int size) {
            return new Period[size];
        }
    };
}