1 17 package org.apache.ws.jaxme.xs.impl; 18 19 import org.apache.ws.jaxme.xs.XSAtomicType; 20 import org.apache.ws.jaxme.xs.XSType; 21 import org.apache.ws.jaxme.xs.xml.XsEFractionDigits; 22 import org.apache.ws.jaxme.xs.xml.XsELength; 23 import org.apache.ws.jaxme.xs.xml.XsEMaxExclusive; 24 import org.apache.ws.jaxme.xs.xml.XsEMaxInclusive; 25 import org.apache.ws.jaxme.xs.xml.XsEMaxLength; 26 import org.apache.ws.jaxme.xs.xml.XsEMinExclusive; 27 import org.apache.ws.jaxme.xs.xml.XsEMinInclusive; 28 import org.apache.ws.jaxme.xs.xml.XsEMinLength; 29 import org.apache.ws.jaxme.xs.xml.XsETotalDigits; 30 import org.apache.ws.jaxme.xs.xml.XsEWhiteSpace; 31 import org.apache.ws.jaxme.xs.xml.XsGSimpleRestrictionModel; 32 import org.xml.sax.SAXException ; 33 34 37 public class XSAtomicTypeRestrictionImpl extends XSSimpleTypeRestrictionImpl implements XSAtomicType { 38 private final XSAtomicType atomicBaseType; 39 40 43 public XSAtomicTypeRestrictionImpl(XSType pParent, 44 XSType pBaseType, XsGSimpleRestrictionModel pRestriction) 45 throws SAXException { 46 super(pParent, pBaseType, pRestriction); 47 atomicBaseType = pBaseType.getSimpleType().getAtomicType(); 48 } 49 50 public boolean isAtomic() { return true; } 51 52 public XSAtomicType getAtomicType() { 53 return this; 54 } 55 56 public Long getFractionDigits() { 57 XsEFractionDigits fractionDigits = getRestriction().getFractionDigits(); 58 if (fractionDigits == null) { 59 return atomicBaseType.getFractionDigits(); 60 } else { 61 return new Long (fractionDigits.getValue()); 62 } 63 } 64 65 public Long getLength() { 66 XsELength length = getRestriction().getLength(); 67 if (length == null) { 68 return atomicBaseType.getLength(); 69 } else { 70 return new Long (length.getValue()); 71 } 72 } 73 74 public String getMaxExclusive() { 75 XsEMaxExclusive maxExclusive = getRestriction().getMaxExclusive(); 76 if (maxExclusive == null) { 77 return atomicBaseType.getMaxExclusive(); 78 } else { 79 return maxExclusive.getValue(); 80 } 81 } 82 83 public String getMaxInclusive() { 84 XsEMaxInclusive maxInclusive = getRestriction().getMaxInclusive(); 85 if (maxInclusive == null) { 86 return atomicBaseType.getMaxInclusive(); 87 } else { 88 return maxInclusive.getValue(); 89 } 90 } 91 92 public Long getMaxLength() { 93 XsEMaxLength length = getRestriction().getMaxLength(); 94 if (length == null) { 95 return atomicBaseType.getMaxLength(); 96 } else { 97 return new Long (length.getValue()); 98 } 99 } 100 101 public String getMinExclusive() { 102 XsEMinExclusive minExclusive = getRestriction().getMinExclusive(); 103 if (minExclusive == null) { 104 return atomicBaseType.getMinExclusive(); 105 } else { 106 return minExclusive.getValue(); 107 } 108 } 109 110 public String getMinInclusive() { 111 XsEMinInclusive minInclusive = getRestriction().getMinInclusive(); 112 if (minInclusive == null) { 113 return atomicBaseType.getMinInclusive(); 114 } else { 115 return minInclusive.getValue(); 116 } 117 } 118 119 public Long getMinLength() { 120 XsEMinLength length = getRestriction().getMinLength(); 121 if (length == null) { 122 return atomicBaseType.getMinLength(); 123 } else { 124 return new Long (length.getValue()); 125 } 126 } 127 128 public Long getTotalDigits() { 129 XsETotalDigits totalDigits = getRestriction().getTotalDigits(); 130 if (totalDigits == null) { 131 return atomicBaseType.getTotalDigits(); 132 } else { 133 return new Long (totalDigits.getValue()); 134 } 135 } 136 137 public boolean isReplacing() { 138 XsEWhiteSpace whiteSpace = getRestriction().getWhiteSpace(); 139 if (whiteSpace == null) { 140 return atomicBaseType.isReplacing(); 141 } else { 142 return whiteSpace.isReplacing() || whiteSpace.isCollapsing(); 143 } 144 } 145 146 public boolean isCollapsing() { 147 XsEWhiteSpace whiteSpace = getRestriction().getWhiteSpace(); 148 if (whiteSpace == null) { 149 return atomicBaseType.isReplacing(); 150 } else { 151 return whiteSpace.isCollapsing(); 152 } 153 } 154 } 155 | Popular Tags |