001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.internal.ws.wsdl.document.schema;
027:
028: import javax.xml.namespace.QName;
029:
030: import com.sun.tools.internal.ws.wsdl.framework.WriterContext;
031:
032: /**
033: *
034: * @author WS Development Team
035: */
036: public class SchemaAttribute {
037:
038: public SchemaAttribute() {
039: }
040:
041: public SchemaAttribute(String localName) {
042: _localName = localName;
043: }
044:
045: public String getNamespaceURI() {
046: return _nsURI;
047: }
048:
049: public void setNamespaceURI(String s) {
050: _nsURI = s;
051: }
052:
053: public String getLocalName() {
054: return _localName;
055: }
056:
057: public void setLocalName(String s) {
058: _localName = s;
059: }
060:
061: public QName getQName() {
062: return new QName(_nsURI, _localName);
063: }
064:
065: public String getValue() {
066: if (_qnameValue != null) {
067: if (_parent == null) {
068: throw new IllegalStateException();
069: } else {
070: return _parent.asString(_qnameValue);
071: }
072: } else {
073: return _value;
074: }
075: }
076:
077: public String getValue(WriterContext context) {
078: if (_qnameValue != null) {
079: return context.getQNameString(_qnameValue);
080: } else {
081: return _value;
082: }
083: }
084:
085: public void setValue(String s) {
086: _value = s;
087: }
088:
089: public void setValue(QName name) {
090: _qnameValue = name;
091: }
092:
093: public SchemaElement getParent() {
094: return _parent;
095: }
096:
097: public void setParent(SchemaElement e) {
098: _parent = e;
099: }
100:
101: private String _nsURI;
102: private String _localName;
103: private String _value;
104: private QName _qnameValue;
105: private SchemaElement _parent;
106: }
|