01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.model.impl;
07:
08: import org.openrdf.model.Namespace;
09:
10: /**
11: * A default implementation of the {@link Namespace} interface.
12: */
13: public class NamespaceImpl implements Namespace {
14:
15: private static final long serialVersionUID = -5829768428912588171L;
16:
17: /*-----------*
18: * Variables *
19: *-----------*/
20:
21: /**
22: * The namespace's prefix.
23: */
24: private String prefix;
25:
26: /**
27: * The namespace's name.
28: */
29: private String name;
30:
31: /*--------------*
32: * Constructors *
33: *--------------*/
34:
35: /**
36: * Creates a new NamespaceImpl object.
37: *
38: * @param prefix
39: * The namespace's prefix.
40: * @param name
41: * The namespace's name.
42: */
43: public NamespaceImpl(String prefix, String name) {
44: setPrefix(prefix);
45: setName(name);
46: }
47:
48: /*---------*
49: * Methods *
50: *---------*/
51:
52: /**
53: * Gets the prefix of the namespace.
54: *
55: * @return prefix of the namespace
56: */
57: public String getPrefix() {
58: return prefix;
59: }
60:
61: /**
62: * Sets the prefix of the namespace.
63: *
64: * @param prefix
65: * The (new) prefix for this namespace.
66: */
67: public void setPrefix(String prefix) {
68: this .prefix = prefix;
69: }
70:
71: /**
72: * Gets the name of the namespace.
73: *
74: * @return name of the namespace
75: */
76: public String getName() {
77: return name;
78: }
79:
80: /**
81: * Sets the name of the namespace.
82: *
83: * @param name
84: * The (new) name for this namespace.
85: */
86: public void setName(String name) {
87: this .name = name;
88: }
89:
90: /**
91: * Returns a string representation of the object.
92: *
93: * @return String representation of the namespace
94: */
95: @Override
96: public String toString() {
97: return prefix + " :: " + name;
98: }
99: }
|