1 16 17 package org.apache.xerces.impl.xs; 18 19 import org.apache.xerces.impl.dv.XSSimpleType; 20 import org.apache.xerces.xs.*; 21 import org.apache.xerces.impl.dv.ValidatedInfo; 22 23 33 public class XSAttributeDecl implements XSAttributeDeclaration { 34 35 public final static short SCOPE_ABSENT = 0; 37 public final static short SCOPE_GLOBAL = 1; 38 public final static short SCOPE_LOCAL = 2; 39 40 String fName = null; 42 String fTargetNamespace = null; 44 XSSimpleType fType = null; 46 short fConstraintType = XSConstants.VC_NONE; 48 short fScope = XSConstants.SCOPE_ABSENT; 50 XSComplexTypeDecl fEnclosingCT = null; 52 XSAnnotationImpl fAnnotation = null; 54 ValidatedInfo fDefault = null; 56 57 public void setValues(String name, String targetNamespace, 58 XSSimpleType simpleType, short constraintType, short scope, 59 ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT, 60 XSAnnotationImpl annotation) { 61 fName = name; 62 fTargetNamespace = targetNamespace; 63 fType = simpleType; 64 fConstraintType = constraintType; 65 fScope = scope; 66 fDefault = valInfo; 67 fEnclosingCT = enclosingCT; 68 fAnnotation = annotation; 69 } 70 71 public void reset(){ 72 fName = null; 73 fTargetNamespace = null; 74 fType = null; 75 fConstraintType = XSConstants.VC_NONE; 76 fScope = XSConstants.SCOPE_ABSENT; 77 fDefault = null; 78 fAnnotation = null; 79 } 80 81 84 public short getType() { 85 return XSConstants.ATTRIBUTE_DECLARATION; 86 } 87 88 92 public String getName() { 93 return fName; 94 } 95 96 101 public String getNamespace() { 102 return fTargetNamespace; 103 } 104 105 108 public XSSimpleTypeDefinition getTypeDefinition() { 109 return fType; 110 } 111 112 119 public short getScope() { 120 return fScope; 121 } 122 123 128 public XSComplexTypeDefinition getEnclosingCTDefinition() { 129 return fEnclosingCT; 130 } 131 132 135 public short getConstraintType() { 136 return fConstraintType; 137 } 138 139 143 public String getConstraintValue() { 144 return getConstraintType() == XSConstants.VC_NONE ? 146 null : 147 fDefault.stringValue(); 148 } 149 150 153 public XSAnnotation getAnnotation() { 154 return fAnnotation; 155 } 156 157 public ValidatedInfo getValInfo() { 158 return fDefault; 159 } 160 163 public XSNamespaceItem getNamespaceItem() { 164 return null; 166 } 167 168 public Object getActualVC() { 169 return getConstraintType() == XSConstants.VC_NONE ? 170 null : 171 fDefault.actualValue; 172 } 173 174 public short getActualVCType() { 175 return getConstraintType() == XSConstants.VC_NONE ? 176 XSConstants.UNAVAILABLE_DT : 177 fDefault.actualValueType; 178 } 179 180 public ShortList getItemValueTypes() { 181 return getConstraintType() == XSConstants.VC_NONE ? 182 null : 183 fDefault.itemValueTypes; 184 } 185 186 } | Popular Tags |