001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.xerces.util;
019:
020: import org.apache.xerces.impl.XMLEntityDescription;
021:
022: /**
023: * <p>This class is an implementation of the XMLEntityDescription
024: * interface which describes the properties of an entity.</p>
025: *
026: * @author Michael Glavassevich, IBM
027: *
028: * @version $Id: XMLEntityDescriptionImpl.java 447241 2006-09-18 05:12:57Z mrglavas $
029: */
030: public class XMLEntityDescriptionImpl extends XMLResourceIdentifierImpl
031: implements XMLEntityDescription {
032:
033: //
034: // Constructors
035: //
036:
037: /** Constructs an empty entity description. */
038: public XMLEntityDescriptionImpl() {
039: } // <init>()
040:
041: /**
042: * Constructs an entity description.
043: *
044: * @param entityName The name of the entity.
045: * @param publicId The public identifier.
046: * @param literalSystemId The literal system identifier.
047: * @param baseSystemId The base system identifier.
048: * @param expandedSystemId The expanded system identifier.
049: */
050: public XMLEntityDescriptionImpl(String entityName, String publicId,
051: String literalSystemId, String baseSystemId,
052: String expandedSystemId) {
053: setDescription(entityName, publicId, literalSystemId,
054: baseSystemId, expandedSystemId);
055: } // <init>(String,String,String,String,String)
056:
057: /**
058: * Constructs a resource identifier.
059: *
060: * @param entityName The name of the entity.
061: * @param publicId The public identifier.
062: * @param literalSystemId The literal system identifier.
063: * @param baseSystemId The base system identifier.
064: * @param expandedSystemId The expanded system identifier.
065: * @param namespace The namespace.
066: */
067: public XMLEntityDescriptionImpl(String entityName, String publicId,
068: String literalSystemId, String baseSystemId,
069: String expandedSystemId, String namespace) {
070: setDescription(entityName, publicId, literalSystemId,
071: baseSystemId, expandedSystemId, namespace);
072: } // <init>(String,String,String,String,String,String)
073:
074: //
075: // Data
076: //
077:
078: /** The name of the entity. */
079: protected String fEntityName;
080:
081: //
082: // Public methods
083: //
084:
085: /**
086: * Sets the name of the entity.
087: *
088: * @param name the name of the entity
089: */
090: public void setEntityName(String name) {
091: fEntityName = name;
092: } // setEntityName(String)
093:
094: /**
095: * Returns the name of the entity.
096: *
097: * @return the name of the entity
098: */
099: public String getEntityName() {
100: return fEntityName;
101: } // getEntityName():String
102:
103: /**
104: * <p>Sets the values of this entity description.</p>
105: *
106: * @param entityName The name of the entity.
107: * @param publicId The public identifier.
108: * @param literalSystemId The literal system identifier.
109: * @param baseSystemId The base system identifier.
110: * @param expandedSystemId The expanded system identifier.
111: */
112: public void setDescription(String entityName, String publicId,
113: String literalSystemId, String baseSystemId,
114: String expandedSystemId) {
115: setDescription(entityName, publicId, literalSystemId,
116: baseSystemId, expandedSystemId, null);
117: } // setDescription(String,String,String,String,String)
118:
119: /**
120: * <p>Sets the values of this entity description.</p>
121: *
122: * @param entityName The name of the entity.
123: * @param publicId The public identifier.
124: * @param literalSystemId The literal system identifier.
125: * @param baseSystemId The base system identifier.
126: * @param expandedSystemId The expanded system identifier.
127: * @param namespace The namespace.
128: */
129: public void setDescription(String entityName, String publicId,
130: String literalSystemId, String baseSystemId,
131: String expandedSystemId, String namespace) {
132: fEntityName = entityName;
133: setValues(publicId, literalSystemId, baseSystemId,
134: expandedSystemId, namespace);
135: } // setDescription(String,String,String,String,String,String)
136:
137: /**
138: * <p>Clears the values.</p>
139: */
140: public void clear() {
141: super .clear();
142: fEntityName = null;
143: } // clear()
144:
145: //
146: // Object methods
147: //
148:
149: /** Returns a hash code for this object. */
150: public int hashCode() {
151: int code = super .hashCode();
152: if (fEntityName != null) {
153: code += fEntityName.hashCode();
154: }
155: return code;
156: } // hashCode():int
157:
158: /** Returns a string representation of this object. */
159: public String toString() {
160: StringBuffer str = new StringBuffer();
161: if (fEntityName != null) {
162: str.append(fEntityName);
163: }
164: str.append(':');
165: if (fPublicId != null) {
166: str.append(fPublicId);
167: }
168: str.append(':');
169: if (fLiteralSystemId != null) {
170: str.append(fLiteralSystemId);
171: }
172: str.append(':');
173: if (fBaseSystemId != null) {
174: str.append(fBaseSystemId);
175: }
176: str.append(':');
177: if (fExpandedSystemId != null) {
178: str.append(fExpandedSystemId);
179: }
180: str.append(':');
181: if (fNamespace != null) {
182: str.append(fNamespace);
183: }
184: return str.toString();
185: } // toString():String
186:
187: } // XMLEntityDescriptionImpl
|