|
|||||||||||||||||||
| 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 | |||||||||||||||
| WhiteSpaceFacet.java | 83,3% | 90% | 100% | 88,9% |
|
||||||||||||||
| 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.base.WhiteSpaceProcessing; |
|
| 13 |
import org.jbind.xml.core.constraint.ConstraintType; |
|
| 14 |
import org.jbind.xml.core.constraint.IConstraints; |
|
| 15 |
import org.jbind.xml.core.type.IAnyType; |
|
| 16 |
import org.jbind.xml.msg.IConstraintViolations; |
|
| 17 |
import org.jbind.xml.msg.XmlMessages; |
|
| 18 |
|
|
| 19 |
public class WhiteSpaceFacet extends Facet {
|
|
| 20 |
|
|
| 21 | 48 |
public WhiteSpaceFacet(CreationParams aCreationParams) {
|
| 22 | 48 |
super(aCreationParams, ConstraintType.WHITE_SPACE); |
| 23 |
} |
|
| 24 |
|
|
| 25 | 48 |
public void doAddConstraint(IAnyType aType, IConstraints aConstraints, IConstraintViolations aViolations) {
|
| 26 | 48 |
WhiteSpaceProcessing p = null; |
| 27 | 48 |
if ("preserve".equals(getValue())) {
|
| 28 | 2 |
p = WhiteSpaceProcessing.PRESERVE; |
| 29 | 46 |
} else if ("replace".equals(getValue())) {
|
| 30 | 4 |
p = WhiteSpaceProcessing.REPLACE; |
| 31 | 42 |
} else if ("collapse".equals(getValue())) {
|
| 32 | 42 |
p = WhiteSpaceProcessing.COLLAPSE; |
| 33 |
} else {
|
|
| 34 | 0 |
aViolations.add(XmlMessages.unknownWhiteSpaceProcessing(getValue(), this)); |
| 35 |
} |
|
| 36 | 48 |
aConstraints.setWhiteSpaceProcessing(p, aViolations, this); |
| 37 |
} |
|
| 38 |
|
|
| 39 |
} |
|
| 40 |
|
|
||||||||||