View Javadoc

1   /*
2    * Copyright (c) 2006-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.danube.webdav.java;
14  
15  /**
16   * This class represents a path to the bean
17   *
18   * @author Daniel Sendula
19   */
20  public class Bean {
21  
22      /** Path from the root object */
23      protected String path;
24  
25      /**
26       * Constructor
27       * @param path a path from the root object
28       */
29      public Bean(String path) {
30          this.path = path;
31      }
32  
33      /**
34       * Returns path
35       * @return path
36       */
37      public String getPath() {
38          return path;
39      }
40  
41      /**
42       * Returns path string's hash code
43       * @return path string's hash code
44       */
45      public int hashCode() {
46          return path.hashCode();
47      }
48  
49      /**
50       * Compares path's of two objects
51       * @param object other object
52       * @return <code>true</code> if two paths are equal
53       */
54      public boolean equals(Object object) {
55          if (object instanceof Bean) {
56              Bean other = (Bean)object;
57              if (path == other.path) {
58                  return true;
59              } else {
60                  return path.equals(other.path);
61              }
62          } else {
63              return false;
64          }
65      }
66  }