/*
* Copyright (c) 2008-2016 MongoDB, Inc.
*
* 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.mongodb.morphia.entities;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
@Entity
public class ParentType {
@Id
private ObjectId id;
private EmbeddedType embedded;
@Property("n")
private String name;
public EmbeddedType getEmbedded() {
return embedded;
}
public void setEmbedded(final EmbeddedType embedded) {
this.embedded = embedded;
}
public ObjectId getId() {
return id;
}
public void setId(final ObjectId id) {
this.id = id;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ParentType)) {
return false;
}
final ParentType that = (ParentType) o;
if (id != null ? !id.equals(that.id) : that.id != null) {
return false;
}
return embedded != null ? embedded.equals(that.embedded) : that.embedded == null;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (embedded != null ? embedded.hashCode() : 0);
return result;
}
}