001: /*
002: * Copyright 2005-2007 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package net.sf.dozer.functional_tests.recursive;
017:
018: import java.util.TreeSet;
019:
020: /**
021: * .
022: *
023: * @author ADE
024: *
025: */
026: public class ClassA {
027: /** */
028: private String nom;
029: /** */
030: private String prenom;
031: /** */
032: private TreeSet subs;
033: /** {@inheritDoc} */
034: private final int prime = 31;
035:
036: /** {@inheritDoc} */
037: public final void addSubs(final ClassB value) {
038: if (value == null) {
039: return;
040: }
041: if (this .getSubs() == null) {
042: this .setSubs(new TreeSet());
043: }
044: this .getSubs().add(value);
045: if (value.getParent() != this ) {
046: value.setParent(this );
047: }
048: }
049:
050: /** {@inheritDoc} */
051: public int hashCode() {
052: int result = 1;
053: result = prime * result
054: + ((this .nom == null) ? 0 : this .nom.hashCode());
055: return result;
056: }
057:
058: /** {@inheritDoc} */
059: public boolean equals(final Object obj) {
060: if (this == obj) {
061: return true;
062: }
063: if (obj == null) {
064: return false;
065: }
066: if (this .getClass() != obj.getClass()) {
067: return false;
068: }
069: final ClassA other = (ClassA) obj;
070: if (this .nom == null) {
071: if (other.nom != null) {
072: return false;
073: }
074: } else if (!this .nom.equals(other.nom)) {
075: return false;
076: }
077: return true;
078: }
079:
080: /** {@inheritDoc} */
081: public String getNom() {
082: return this .nom;
083: }
084:
085: /** {@inheritDoc} */
086: public void setNom(final String nom) {
087: this .nom = nom;
088: }
089:
090: /** {@inheritDoc} */
091: public String getPrenom() {
092: return this .prenom;
093: }
094:
095: /** {@inheritDoc} */
096: public void setPrenom(final String prenom) {
097: this .prenom = prenom;
098: }
099:
100: /** {@inheritDoc} */
101: public TreeSet getSubs() {
102: return this .subs;
103: }
104:
105: /** {@inheritDoc} */
106: public void setSubs(final TreeSet subs) {
107: this.subs = subs;
108: }
109: }
|