001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the License). You may not use this file except in
005: * compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * Header Notice in each file and include the License file
014: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
015: * If applicable, add the following below the CDDL Header,
016: * with the fields enclosed by brackets [] replaced by
017: * you own identifying information:
018: * "Portions Copyrighted [year] [name of copyright owner]"
019: *
020: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
021: */
022:
023: /*
024: * StAXAttr.java
025: *
026: * Created on August 22, 2005, 5:24 AM
027: *
028: * To change this template, choose Tools | Options and locate the template under
029: * the Source Creation and Management node. Right-click the template and choose
030: * Open. You can then make changes to the template in the Source Editor.
031: */
032:
033: package com.sun.xml.wss.impl.c14n;
034:
035: /**
036: *
037: * @author root
038: */
039: public class StAXAttr implements Comparable {
040: private String prefix = "";
041: private String value = null;
042: private String localName = null;
043: private String uri = "";
044:
045: /** Creates a new instance of StAXAttr */
046: public StAXAttr() {
047: }
048:
049: public String getPrefix() {
050: return prefix;
051: }
052:
053: public void setPrefix(String prefix) {
054: if (prefix == null) {
055: return;
056: }
057: this .prefix = prefix;
058: }
059:
060: public String getLocalName() {
061: return localName;
062: }
063:
064: public void setLocalName(String localName) {
065: this .localName = localName;
066: }
067:
068: public String getValue() {
069: return value;
070: }
071:
072: public void setValue(String value) {
073: this .value = value;
074: }
075:
076: public String getUri() {
077: return uri;
078: }
079:
080: public void setUri(String uri) {
081: if (uri == null) {
082: return;
083: }
084: this .uri = uri;
085: }
086:
087: public int compareTo(Object cmp) {
088: return sortAttributes(cmp, this );
089: }
090:
091: protected int sortAttributes(Object object, Object object0) {
092: StAXAttr attr = (StAXAttr) object;
093: StAXAttr attr0 = (StAXAttr) object0;
094: String uri = attr.getUri();
095: String uri0 = attr0.getUri();
096: int result = uri.compareTo(uri0);
097: if (result == 0) {
098: String lN = attr.getLocalName();
099: String lN0 = attr0.getLocalName();
100: result = lN.compareTo(lN0);
101: }
102: return result;
103: }
104:
105: }
|