KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > wireless > voicexml > dom > xerces > VoiceXMLElementImpl


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Original Code is DigitalSesame
15  * Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
16  * All Rights Reserved.
17  *
18  * Contributor(s):
19  *
20  * $Id: VoiceXMLElementImpl.java,v 1.2 2005/01/26 08:28:45 jkjome Exp $
21  */

22
23 package org.enhydra.wireless.voicexml.dom.xerces;
24
25 import org.enhydra.apache.xerces.dom.ElementNSImpl;
26 import org.enhydra.wireless.voicexml.dom.VoiceXMLElement;
27
28 public class VoiceXMLElementImpl extends ElementNSImpl implements VoiceXMLElement {
29
30     public VoiceXMLElementImpl(VoiceXMLDocumentImpl owner,
31                                String JavaDoc namespaceURI,
32                                String JavaDoc qualifiedName) {
33     super(owner, namespaceURI, qualifiedName);
34     }
35
36     /*
37      * Get the value of a boolean attribute.
38      */

39     protected final boolean getBooleanAttribute(String JavaDoc attr,
40                                                 boolean defaultValue) {
41     String JavaDoc attrVal = getAttribute(attr);
42         if (attrVal != null) {
43             return attrVal.equals("true");
44         } else {
45             return defaultValue;
46         }
47     }
48
49     /*
50      * Get the value of a boolean attribute.
51      */

52     protected final boolean getBooleanAttribute(String JavaDoc attr) {
53         return getBooleanAttribute(attr, false);
54     }
55
56     /*
57      * Set the value of a boolean attribute.
58      */

59     protected final void setAttribute(String JavaDoc attr,
60                                       boolean value) {
61         setAttribute(attr, (value ? "true" : "false"));
62     }
63
64     /*
65      * Get the value of a integer attribute
66      */

67     protected final int getIntAttribute(String JavaDoc attr,
68                                         int defaultValue) {
69     String JavaDoc attrVal = getAttribute(attr);
70     if (attrVal != null) {
71             return Integer.parseInt(attrVal);
72     } else {
73             return defaultValue;
74         }
75     }
76
77     /*
78      * Get the value of a integer attribute
79      */

80     protected final int getIntAttribute(String JavaDoc attr) {
81         return getIntAttribute(attr, 0);
82     }
83
84     /*
85      * Set the value of a integer attribute.
86      */

87     protected final void setAttribute(String JavaDoc attr,
88                                       int value) {
89         setAttribute(attr, Integer.toString(value));
90     }
91 }
92
Popular Tags