DrawExtrusionFirstLightHarshAttribute.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. /*
  25.  * This file is automatically generated.
  26.  * Don't edit manually.
  27.  */
  28. package org.odftoolkit.odfdom.dom.attribute.draw;

  29. import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
  30. import org.odftoolkit.odfdom.pkg.OdfAttribute;
  31. import org.odftoolkit.odfdom.pkg.OdfElement;
  32. import org.odftoolkit.odfdom.pkg.OdfFileDom;
  33. import org.odftoolkit.odfdom.pkg.OdfName;

  34. /**
  35.  * DOM implementation of OpenDocument attribute {@odf.attribute draw:extrusion-first-light-harsh}.
  36.  */
  37. public class DrawExtrusionFirstLightHarshAttribute extends OdfAttribute {

  38.   public static final OdfName ATTRIBUTE_NAME =
  39.       OdfName.newName(OdfDocumentNamespace.DRAW, "extrusion-first-light-harsh");
  40.   public static final String DEFAULT_VALUE = "true";

  41.   /**
  42.    * Create the instance of OpenDocument attribute {@odf.attribute
  43.    * draw:extrusion-first-light-harsh}.
  44.    *
  45.    * @param ownerDocument The type is <code>OdfFileDom</code>
  46.    */
  47.   public DrawExtrusionFirstLightHarshAttribute(OdfFileDom ownerDocument) {
  48.     super(ownerDocument, ATTRIBUTE_NAME);
  49.   }

  50.   /**
  51.    * Returns the attribute name.
  52.    *
  53.    * @return the <code>OdfName</code> for {@odf.attribute draw:extrusion-first-light-harsh}.
  54.    */
  55.   @Override
  56.   public OdfName getOdfName() {
  57.     return ATTRIBUTE_NAME;
  58.   }

  59.   /** @return Returns the name of this attribute. */
  60.   @Override
  61.   public String getName() {
  62.     return ATTRIBUTE_NAME.getLocalName();
  63.   }

  64.   /** @param value The <code>boolean</code> value of the attribute. */
  65.   public void setBooleanValue(boolean value) {
  66.     super.setValue(String.valueOf(value));
  67.   }

  68.   /** @return Returns the <code>boolean</code> value of the attribute */
  69.   public boolean booleanValue() {
  70.     String val = super.getValue();
  71.     try {
  72.       return Boolean.parseBoolean(val);
  73.     } catch (NumberFormatException e) {
  74.       // TODO: validation handling/logging
  75.       throw (e);
  76.     }
  77.   }

  78.   /**
  79.    * Returns the default value of {@odf.attribute draw:extrusion-first-light-harsh}.
  80.    *
  81.    * @return the default value as <code>String</code> dependent of its element name return <code>
  82.    *     null</code> if the default value does not exist
  83.    */
  84.   @Override
  85.   public String getDefault() {
  86.     OdfElement parentElement = (OdfElement) getOwnerElement();
  87.     String defaultValue = null;
  88.     if (parentElement != null) {
  89.       defaultValue = DEFAULT_VALUE;
  90.     }
  91.     return defaultValue;
  92.   }

  93.   /**
  94.    * Default value indicator. As the attribute default value is dependent from its element, the
  95.    * attribute has only a default, when a parent element exists.
  96.    *
  97.    * @return <code>true</code> if {@odf.attribute draw:extrusion-first-light-harsh} has an element
  98.    *     parent otherwise return <code>false</code> as undefined.
  99.    */
  100.   @Override
  101.   public boolean hasDefault() {
  102.     return getOwnerElement() == null ? false : true;
  103.   }

  104.   /** @return Returns whether this attribute is known to be of type ID (i.e. xml:id ?) */
  105.   @Override
  106.   public boolean isId() {
  107.     return false;
  108.   }
  109. }