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: public class ClassAPrime {
022: /** */
023: private String nom;
024: /** */
025: private String prenom;
026: /** */
027: private TreeSet subs;
028: /** */
029: private final int prime = 31;
030:
031: /** {@inheritDoc} */
032: public final void addSubs(final ClassBPrime value) {
033: if (value == null) {
034: return;
035: }
036: if (this .getSubs() == null) {
037: this .setSubs(new TreeSet());
038: }
039: this .getSubs().add(value);
040: if (value.getParent() != this ) {
041: value.setParent(this );
042: }
043: }
044:
045: /** {@inheritDoc} */
046: public String getNom() {
047: return this .nom;
048: }
049:
050: /** {@inheritDoc} */
051: public void setNom(final String nom) {
052: this .nom = nom;
053: }
054:
055: /** {@inheritDoc} */
056: public String getPrenom() {
057: return this .prenom;
058: }
059:
060: /** {@inheritDoc} */
061: public void setPrenom(final String prenom) {
062: this .prenom = prenom;
063: }
064:
065: /** {@inheritDoc} */
066: public TreeSet getSubs() {
067: return this .subs;
068: }
069:
070: /** {@inheritDoc} */
071: public void setSubs(final TreeSet subs) {
072: this .subs = subs;
073: }
074:
075: /** {@inheritDoc} */
076: public int hashCode() {
077: int result = 1;
078: result = prime * result
079: + ((this .nom == null) ? 0 : this .nom.hashCode());
080: return result;
081: }
082:
083: /** {@inheritDoc} */
084: public boolean equals(final Object obj) {
085: if (this == obj) {
086: return true;
087: }
088: if (obj == null) {
089: return false;
090: }
091: if (this .getClass() != obj.getClass()) {
092: return false;
093: }
094: final ClassAPrime other = (ClassAPrime) obj;
095: if (this .nom == null) {
096: if (other.nom != null) {
097: return false;
098: }
099: } else if (!this .nom.equals(other.nom)) {
100: return false;
101: }
102: return true;
103: }
104: }
|