KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > components > Location


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  * The contents of this file are subject to the Mozilla Public License Version
4  * 1.1 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  * http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10  * for the specific language governing rights and limitations under the
11  * License.
12  *
13  * The Original Code is Riot.
14  *
15  * The Initial Developer of the Original Code is
16  * Neteye GmbH.
17  * Portions created by the Initial Developer are Copyright (C) 2007
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * Felix Gnass [fgnass at neteye dot de]
22  *
23  * ***** END LICENSE BLOCK ***** */

24 package org.riotfamily.components;
25
26 /**
27  * Class that represents the location of a {@link ComponentList}.
28  * @see ComponentListLocator
29  * @author Felix Gnass [fgnass at neteye dot de]
30  * @since 6.5
31  */

32 public class Location {
33
34     private String JavaDoc type;
35
36     private String JavaDoc path;
37
38     private String JavaDoc slot;
39
40     public Location() {
41     }
42
43     public Location(Location location) {
44         type = location.getType();
45         path = location.getPath();
46         slot = location.getSlot();
47     }
48
49     public String JavaDoc getPath() {
50         return this.path;
51     }
52
53     public void setPath(String JavaDoc path) {
54         this.path = path;
55     }
56
57     public String JavaDoc getSlot() {
58         return this.slot;
59     }
60
61     public void setSlot(String JavaDoc slot) {
62         this.slot = slot;
63     }
64
65     public String JavaDoc getType() {
66         return this.type;
67     }
68
69     public void setType(String JavaDoc type) {
70         this.type = type;
71     }
72
73     public boolean equals(Object JavaDoc obj) {
74         if (obj instanceof Location) {
75             return toString().equals(obj.toString());
76         }
77         return false;
78     }
79
80     public int hashCode() {
81         return toString().hashCode();
82     }
83
84     public String JavaDoc toString() {
85         return type + "://" + path + '#' + slot;
86     }
87
88 }
89
Popular Tags