KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > core > naming > DefaultName


1 /*===========================================================================
2
3 ObjectWeb Naming Context Framework
4 Copyright (C) 2002 USTL - LIFL - GOAL
5 Contact: architecture@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ===========================================================================*/

26
27 package org.objectweb.util.browser.core.naming;
28
29 /** To use the Name interface. */
30 import org.objectweb.util.browser.core.api.Name;
31
32 /**
33  * Default basic implementation of the Name interface.
34  *
35  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
36  * @version 0.1
37  */

38 public class DefaultName extends AbstractName {
39
40     // ==================================================================
41
//
42
// Internal state.
43
//
44
// ==================================================================
45

46     /** The identifier. */
47     private String JavaDoc id_;
48
49     /** The subname. */
50     private Name subname_;
51
52     // ==================================================================
53
//
54
// Constructors.
55
//
56
// ==================================================================
57

58     /**
59      * Constructs a DefaultName with no id and no subname.
60      *
61      * This constructor sets the id and the subname to the null value.
62      *
63      * @postcondition
64      * getOWId() == null
65      * and getOWSubName() == null;
66      */

67     public DefaultName() {
68         this(null, null);
69     }
70
71     /**
72      * Constructs a DefaultName with an id and no subname.
73      *
74      * This constructor sets the id to the given id
75      * and the subname to the null value.
76      *
77      * @param id The identifier.
78      *
79      * @postcondition
80      * getOWId() == id
81      * and getOWSubName() == null;
82      */

83     public DefaultName(String JavaDoc id) {
84         this(id, null);
85     }
86
87     /**
88      * Constructs a DefaultName with an id and a subname.
89      *
90      * This constructor sets the id and the subname
91      * to respectively the given id and subname.
92      *
93      * @param id The identifier.
94      * @param subname The subname.
95      *
96      * @postcondition
97      * getOWId() == id
98      * and getOWSubName() == subname;
99      */

100     public DefaultName(String JavaDoc id, Name subname) {
101         // Inits the internal state.
102
id_ = id;
103         subname_ = subname;
104     }
105
106     // ==================================================================
107
//
108
// No internal methods.
109
//
110
// ==================================================================
111

112     // ==================================================================
113
//
114
// Public methods for interface Name.
115
//
116
// ==================================================================
117

118     /**
119      * Gets the id of the target name.
120      *
121      * This method does not update the id of the target name.
122      *
123      * @return The id of the target name.
124      *
125      * @postcondition return == getOWId();
126      */

127     public String JavaDoc getOWId() {
128         return id_;
129     }
130
131     /**
132      * Gets the subname of the target name.
133      *
134      * This method does not update the subname of the target name.
135      *
136      * @retrn the subname of the target name.
137      *
138      * @postcondition return == getOWSubName();
139      */

140     public Name getOWSubName() {
141         return subname_;
142     }
143
144 }
145
Popular Tags