|
|||||||||||||||||||
| This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| BooleanAttribute.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
/* |
|
| 2 |
* JBind |
|
| 3 |
* |
|
| 4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
| 5 |
* |
|
| 6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
| 7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
| 8 |
* 'Apache Software License V 1.1'. |
|
| 9 |
*/ |
|
| 10 |
package org.jbind.xml.schema.element; |
|
| 11 |
|
|
| 12 |
import org.jbind.xml.msg.XmlException; |
|
| 13 |
import org.jbind.xml.msg.XmlMessages; |
|
| 14 |
|
|
| 15 |
public class BooleanAttribute extends Attribute {
|
|
| 16 |
|
|
| 17 |
private boolean myBoolean; |
|
| 18 |
|
|
| 19 | 146 |
public BooleanAttribute(ACParams anACParams) throws XmlException {
|
| 20 | 146 |
super(anACParams); |
| 21 | 146 |
if ("true".equals(anACParams.value) || "1".equals(anACParams.value)) {
|
| 22 | 89 |
myBoolean = true; |
| 23 | 57 |
} else if ("false".equals(anACParams.value) || "0".equals(anACParams.value)) {
|
| 24 | 56 |
myBoolean = false; |
| 25 |
} else {
|
|
| 26 | 1 |
throw new XmlException(XmlMessages.invalidBoolean(anACParams.value, this)); |
| 27 |
} |
|
| 28 |
} |
|
| 29 |
|
|
| 30 | 725 |
public boolean getBoolean() {
|
| 31 | 725 |
return myBoolean; |
| 32 |
} |
|
| 33 |
} |
|
| 34 |
|
|
||||||||||