OdfAttribute.java

  1. /**
  2.  * **********************************************************************
  3.  *
  4.  * <p>DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
  5.  *
  6.  * <p>Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved.
  7.  *
  8.  * <p>Use is subject to license terms.
  9.  *
  10.  * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  11.  * except in compliance with the License. You may obtain a copy of the License at
  12.  * http://www.apache.org/licenses/LICENSE-2.0. You can also obtain a copy of the License at
  13.  * http://odftoolkit.org/docs/license.txt
  14.  *
  15.  * <p>Unless required by applicable law or agreed to in writing, software distributed under the
  16.  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  17.  * express or implied.
  18.  *
  19.  * <p>See the License for the specific language governing permissions and limitations under the
  20.  * License.
  21.  *
  22.  * <p>**********************************************************************
  23.  */
  24. package org.odftoolkit.odfdom.pkg;

  25. import org.apache.xerces.dom.AttrNSImpl;
  26. import org.w3c.dom.DOMException;

  27. /** Base class for all attributes of the OpenDocument format */
  28. public abstract class OdfAttribute extends AttrNSImpl {

  29.   /**
  30.    * Returns the attribute name.
  31.    *
  32.    * @return the <code>OdfName</code> for the attribute.
  33.    */
  34.   public abstract OdfName getOdfName();

  35.   /**
  36.    * Creates a new instance of OdfAttribute
  37.    *
  38.    * @param ownerDocument - the document the attribute belongs to
  39.    * @param namespaceURI - The namespace URI of the attribute to create. When it is null or an empty
  40.    *     string, this method behaves like createAttribute.
  41.    * @param qualifiedName - The qualified name of the attribute to instantiate.
  42.    * @throws DOMException - if the attribute could not be created
  43.    */
  44.   public OdfAttribute(OdfFileDom ownerDocument, String namespaceURI, String qualifiedName)
  45.       throws DOMException {
  46.     super(ownerDocument, namespaceURI, qualifiedName);
  47.   }

  48.   /**
  49.    * Creates a new instance of OdfAttribute
  50.    *
  51.    * @param ownerDocument - the document the attribute belongs to
  52.    * @param name - the <code>OdfName</code> representation of the attribute name.
  53.    * @throws DOMException - if the attribute could not be created
  54.    */
  55.   public OdfAttribute(OdfFileDom ownerDocument, OdfName name) throws DOMException {
  56.     super(ownerDocument, name.getUri(), name.getQName());
  57.   }

  58.   /**
  59.    * Returns the default value of {@odf.attribute table:number-columns-repeated}.
  60.    *
  61.    * @return the default value as String
  62.    */
  63.   public abstract String getDefault();

  64.   /**
  65.    * Default value indicator
  66.    *
  67.    * @return true if a default exists
  68.    */
  69.   public abstract boolean hasDefault();
  70. }