All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.social.twitter.api.Entities Maven / Gradle / Ivy

There is a newer version: 1.1.2.RELEASE
Show newest version
/*
 * Copyright 2013 the original author or authors.
 *
 * 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 org.springframework.social.twitter.api;

import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
 * A json representation of entities found within twitter status objects.
 * 

* User: bowen * Date: 12/26/11 */ public class Entities implements Serializable { private static final long serialVersionUID = 1L; private List urls = new LinkedList(); private List tags = new LinkedList(); private List mentions = new LinkedList(); private List media = new LinkedList(); private List tickerSymbols = new LinkedList(); public Entities(List urls, List tags, List mentions, List media) { this.urls = urls; this.tags = tags; this.mentions = mentions; this.media = media; } public Entities(List urls, List tags, List mentions, List media, List tickerSymbols) { this(urls, tags, mentions, media); this.tickerSymbols = tickerSymbols; } public List getUrls() { if (this.urls == null) { return Collections.emptyList(); } return this.urls; } public List getHashTags() { if (this.tags == null) { return Collections.emptyList(); } return this.tags; } public List getMentions() { if (this.mentions == null) { return Collections.emptyList(); } return this.mentions; } public List getMedia() { if (this.media == null) { return Collections.emptyList(); } return this.media; } public List getTickerSymbols() { if (this.tickerSymbols == null) { return Collections.emptyList(); } return this.tickerSymbols; } public boolean hasUrls() { return this.urls != null && !this.urls.isEmpty(); } public boolean hasTags() { return this.tags != null && !this.tags.isEmpty(); } public boolean hasMentions() { return this.mentions != null && !this.mentions.isEmpty(); } public boolean hasMedia() { return this.media != null && !this.media.isEmpty(); } public boolean hasTickerSymbols() { return this.tickerSymbols != null && !this.tickerSymbols.isEmpty(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Entities entities = (Entities) o; if (media != null ? !media.equals(entities.media) : entities.media != null) { return false; } if (mentions != null ? !mentions.equals(entities.mentions) : entities.mentions != null) { return false; } if (tags != null ? !tags.equals(entities.tags) : entities.tags != null) { return false; } if (urls != null ? !urls.equals(entities.urls) : entities.urls != null) { return false; } if (tickerSymbols != null ? !tickerSymbols.equals(entities.tickerSymbols) : entities.tickerSymbols != null) { return false; } return true; } @Override public int hashCode() { int result = urls != null ? urls.hashCode() : 0; result = 31 * result + (tags != null ? tags.hashCode() : 0); result = 31 * result + (mentions != null ? mentions.hashCode() : 0); result = 31 * result + (media != null ? media.hashCode() : 0); result = 31 * result + (tickerSymbols != null ? tickerSymbols.hashCode() : 0); return result; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy