
info.archinnov.achilles.test.integration.entity.Tweet Maven / Gradle / Ivy
The newest version!
/**
*
* Copyright (C) 2012-2013 DuyHai DOAN
*
* 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 info.archinnov.achilles.test.integration.entity;
import info.archinnov.achilles.annotations.Column;
import info.archinnov.achilles.annotations.Entity;
import info.archinnov.achilles.annotations.Id;
import info.archinnov.achilles.type.Counter;
import java.util.UUID;
@Entity
public class Tweet {
@Id
private UUID id;
@Column
private User creator;
@Column
private String content;
@Column
private Counter favoriteCount;
public Tweet() {
}
public Tweet(UUID id, String content) {
this.id = id;
this.content = content;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public User getCreator() {
return creator;
}
public void setCreator(User creator) {
this.creator = creator;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Counter getFavoriteCount() {
return favoriteCount;
}
public void setFavoriteCount(Counter favoriteCount) {
this.favoriteCount = favoriteCount;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((content == null) ? 0 : content.hashCode());
result = prime * result + ((creator == null) ? 0 : creator.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tweet other = (Tweet) obj;
if (content == null) {
if (other.content != null)
return false;
} else if (!content.equals(other.content))
return false;
if (creator == null) {
if (other.creator != null)
return false;
} else if (!creator.equals(other.creator))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy