001: /*
002: * $Id: EntityDeclarationImpl.java,v 1.2 2006/04/01 06:01:34 jeffsuttor Exp $
003: */
004:
005: /*
006: * The contents of this file are subject to the terms
007: * of the Common Development and Distribution License
008: * (the License). You may not use this file except in
009: * compliance with the License.
010: *
011: * You can obtain a copy of the license at
012: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
013: * See the License for the specific language governing
014: * permissions and limitations under the License.
015: *
016: * When distributing Covered Code, include this CDDL
017: * Header Notice in each file and include the License file
018: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
019: * If applicable, add the following below the CDDL Header,
020: * with the fields enclosed by brackets [] replaced by
021: * you own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * [Name of File] [ver.__] [Date]
025: *
026: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
027: */
028:
029: package com.sun.xml.stream.events;
030:
031: import javax.xml.stream.events.EntityDeclaration;
032: import javax.xml.stream.events.XMLEvent;
033: import com.sun.xml.stream.xerces.xni.XMLResourceIdentifier;
034:
035: /**
036: *
037: * This class store all the information for a particular EntityDeclaration. EntityDeclaration interface
038: * has various get* functiosn to retirve information about a particular EntityDeclaration.
039: *
040: * @author Neeraj Bajaj, Sun Microsystems.
041: */
042: public class EntityDeclarationImpl extends DummyEvent implements
043: EntityDeclaration {
044:
045: private XMLResourceIdentifier fXMLResourceIdentifier;
046: private String fEntityName;
047: private String fReplacementText;
048: private String fNotationName;
049:
050: /** Creates a new instance of EntityDeclarationImpl */
051: public EntityDeclarationImpl() {
052: init();
053: }
054:
055: public EntityDeclarationImpl(String entityName,
056: String replacementText) {
057: this (entityName, replacementText, null);
058:
059: }
060:
061: public EntityDeclarationImpl(String entityName,
062: String replacementText,
063: XMLResourceIdentifier resourceIdentifier) {
064: init();
065: fEntityName = entityName;
066: fReplacementText = replacementText;
067: fXMLResourceIdentifier = resourceIdentifier;
068: }
069:
070: public void setEntityName(String entityName) {
071: fEntityName = entityName;
072: }
073:
074: public String getEntityName() {
075: return fEntityName;
076: }
077:
078: public void setEntityReplacementText(String replacementText) {
079: fReplacementText = replacementText;
080: }
081:
082: public void setXMLResourceIdentifier(
083: XMLResourceIdentifier resourceIdentifier) {
084: fXMLResourceIdentifier = resourceIdentifier;
085: }
086:
087: public XMLResourceIdentifier getXMLResourceIdentifier() {
088: return fXMLResourceIdentifier;
089: }
090:
091: public String getSystemId() {
092: if (fXMLResourceIdentifier != null)
093: return fXMLResourceIdentifier.getLiteralSystemId();
094: return null;
095: }
096:
097: public String getPublicId() {
098: if (fXMLResourceIdentifier != null)
099: return fXMLResourceIdentifier.getPublicId();
100:
101: return null;
102: }
103:
104: public String getBaseURI() {
105: if (fXMLResourceIdentifier != null)
106: return fXMLResourceIdentifier.getBaseSystemId();
107: return null;
108: }
109:
110: public String getName() {
111: return fEntityName;
112: }
113:
114: public String getNotationName() {
115: return fNotationName;
116: }
117:
118: public void setNotationName(String notationName) {
119: fNotationName = notationName;
120: }
121:
122: public String getReplacementText() {
123: return fReplacementText;
124: }
125:
126: protected void init() {
127: setEventType(XMLEvent.ENTITY_DECLARATION);
128: }
129: }
|