facebook4j.MilestoneUpdate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of facebook4j-core Show documentation
Show all versions of facebook4j-core Show documentation
A Java library for the Facebook Graph API
/*
* Copyright 2012 Ryuji Yamashita
*
* 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 facebook4j;
import facebook4j.internal.http.HttpParameter;
import facebook4j.internal.util.z_F4JInternalStringUtil;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
* @author Ryuji Yamashita - roundrop at gmail.com
* @since Facebook4J 2.0.0
*/
public final class MilestoneUpdate implements java.io.Serializable {
private static final long serialVersionUID = 7488064115483210172L;
private final String title;
private final String description;
private final Calendar startTime;
public MilestoneUpdate(String title, String description, Calendar startTime) {
this.title = title;
this.description = description;
this.startTime = startTime;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public Calendar getStartTime() {
return startTime;
}
/*package*/ HttpParameter[] asHttpParameterArray() {
List params = new ArrayList();
params.add(new HttpParameter("title", title));
params.add(new HttpParameter("description", description));
params.add(new HttpParameter("start_time", z_F4JInternalStringUtil.formatISO8601Datetime(startTime)));
return params.toArray(new HttpParameter[params.size()]);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof MilestoneUpdate)) return false;
MilestoneUpdate that = (MilestoneUpdate) o;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (startTime != null ? !startTime.equals(that.startTime) : that.startTime != null) return false;
if (title != null ? !title.equals(that.title) : that.title != null) return false;
return true;
}
@Override
public int hashCode() {
int result = title != null ? title.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "MilestoneUpdate{" +
"title='" + title + '\'' +
", description='" + description + '\'' +
", startTime=" + startTime +
'}';
}
}