Sat, 07 Nov 2020 10:30:02 +0800
Added tag mips-jdk8u275-b01 for changeset fdbe50121f48
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.tools.internal.xjc.model; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import java.awt.*; |
aoqi@0 | 29 | import java.math.BigDecimal; |
aoqi@0 | 30 | import java.math.BigInteger; |
aoqi@0 | 31 | import java.util.HashMap; |
aoqi@0 | 32 | import java.util.Map; |
aoqi@0 | 33 | |
aoqi@0 | 34 | import javax.activation.DataHandler; |
aoqi@0 | 35 | import javax.activation.MimeType; |
aoqi@0 | 36 | import javax.xml.bind.DatatypeConverter; |
aoqi@0 | 37 | import javax.xml.bind.annotation.XmlIDREF; |
aoqi@0 | 38 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; |
aoqi@0 | 39 | import javax.xml.bind.annotation.adapters.HexBinaryAdapter; |
aoqi@0 | 40 | import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; |
aoqi@0 | 41 | import javax.xml.bind.annotation.adapters.XmlAdapter; |
aoqi@0 | 42 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
aoqi@0 | 43 | import javax.xml.datatype.Duration; |
aoqi@0 | 44 | import javax.xml.datatype.XMLGregorianCalendar; |
aoqi@0 | 45 | import javax.xml.namespace.QName; |
aoqi@0 | 46 | import javax.xml.transform.Source; |
aoqi@0 | 47 | |
aoqi@0 | 48 | import com.sun.codemodel.internal.JExpr; |
aoqi@0 | 49 | import com.sun.codemodel.internal.JExpression; |
aoqi@0 | 50 | import com.sun.codemodel.internal.JType; |
aoqi@0 | 51 | import com.sun.tools.internal.xjc.model.nav.NClass; |
aoqi@0 | 52 | import com.sun.xml.internal.bind.v2.model.annotation.Locatable; |
aoqi@0 | 53 | import com.sun.xml.internal.bind.v2.model.core.BuiltinLeafInfo; |
aoqi@0 | 54 | import com.sun.xml.internal.bind.v2.model.core.Element; |
aoqi@0 | 55 | import com.sun.xml.internal.bind.v2.model.core.LeafInfo; |
aoqi@0 | 56 | import com.sun.xml.internal.bind.v2.runtime.Location; |
aoqi@0 | 57 | import com.sun.tools.internal.xjc.model.nav.NType; |
aoqi@0 | 58 | import com.sun.tools.internal.xjc.model.nav.NavigatorImpl; |
aoqi@0 | 59 | import com.sun.tools.internal.xjc.outline.Aspect; |
aoqi@0 | 60 | import com.sun.tools.internal.xjc.outline.Outline; |
aoqi@0 | 61 | import com.sun.tools.internal.xjc.runtime.ZeroOneBooleanAdapter; |
aoqi@0 | 62 | import com.sun.tools.internal.xjc.util.NamespaceContextAdapter; |
aoqi@0 | 63 | import com.sun.xml.internal.bind.v2.WellKnownNamespace; |
aoqi@0 | 64 | import com.sun.xml.internal.bind.v2.model.core.ID; |
aoqi@0 | 65 | import com.sun.xml.internal.xsom.XSComponent; |
aoqi@0 | 66 | import com.sun.xml.internal.xsom.XmlString; |
aoqi@0 | 67 | |
aoqi@0 | 68 | import org.xml.sax.Locator; |
aoqi@0 | 69 | |
aoqi@0 | 70 | /** |
aoqi@0 | 71 | * Encapsulates the default handling for leaf classes (which are bound |
aoqi@0 | 72 | * to text in XML.) In particular this class knows how to convert |
aoqi@0 | 73 | * the lexical value into the Java class according to this default rule. |
aoqi@0 | 74 | * |
aoqi@0 | 75 | * <p> |
aoqi@0 | 76 | * This represents the spec-defined default handling for the Java |
aoqi@0 | 77 | * type ({@link #getType()}. |
aoqi@0 | 78 | * |
aoqi@0 | 79 | * <p> |
aoqi@0 | 80 | * For those Java classes (such as {@link String} or {@link Boolean}) |
aoqi@0 | 81 | * where the spec designates a specific default handling, there are |
aoqi@0 | 82 | * constants in this class (such as {@link #STRING} or {@link #BOOLEAN}.) |
aoqi@0 | 83 | * |
aoqi@0 | 84 | * <p> |
aoqi@0 | 85 | * The generated type-safe enum classes are also a leaf class, |
aoqi@0 | 86 | * and as such there are {@link CEnumLeafInfo} that represents it |
aoqi@0 | 87 | * as {@link CBuiltinLeafInfo}. |
aoqi@0 | 88 | * |
aoqi@0 | 89 | * <p> |
aoqi@0 | 90 | * This class represents the <b>default handling</b>, and therefore |
aoqi@0 | 91 | * we can only have one instance per one {@link NType}. Handling of |
aoqi@0 | 92 | * other XML Schema types (such as xs:token) are represented as |
aoqi@0 | 93 | * a general {@link TypeUse} objects. |
aoqi@0 | 94 | * |
aoqi@0 | 95 | * |
aoqi@0 | 96 | * @author Kohsuke Kawaguchi |
aoqi@0 | 97 | */ |
aoqi@0 | 98 | public abstract class CBuiltinLeafInfo implements CNonElement, BuiltinLeafInfo<NType,NClass>, LeafInfo<NType,NClass>, Location { |
aoqi@0 | 99 | |
aoqi@0 | 100 | private final NType type; |
aoqi@0 | 101 | /** |
aoqi@0 | 102 | * Can be null for anonymous types. |
aoqi@0 | 103 | */ |
aoqi@0 | 104 | private final QName typeName; |
aoqi@0 | 105 | |
aoqi@0 | 106 | private final QName[] typeNames; |
aoqi@0 | 107 | |
aoqi@0 | 108 | private final ID id; |
aoqi@0 | 109 | |
aoqi@0 | 110 | // no derived class other than the spec-defined ones. definitely not for enum. |
aoqi@0 | 111 | private CBuiltinLeafInfo(NType typeToken, ID id, QName... typeNames) { |
aoqi@0 | 112 | this.type = typeToken; |
aoqi@0 | 113 | this.typeName = typeNames.length>0?typeNames[0]:null; |
aoqi@0 | 114 | this.typeNames = typeNames; |
aoqi@0 | 115 | this.id = id; |
aoqi@0 | 116 | } |
aoqi@0 | 117 | |
aoqi@0 | 118 | /** |
aoqi@0 | 119 | * Gets the code model representation of this type. |
aoqi@0 | 120 | */ |
aoqi@0 | 121 | public JType toType(Outline o, Aspect aspect) { |
aoqi@0 | 122 | return getType().toType(o,aspect); |
aoqi@0 | 123 | } |
aoqi@0 | 124 | |
aoqi@0 | 125 | /** |
aoqi@0 | 126 | * Since {@link CBuiltinLeafInfo} represents a default binding, |
aoqi@0 | 127 | * it is never a collection. |
aoqi@0 | 128 | */ |
aoqi@0 | 129 | @Deprecated |
aoqi@0 | 130 | public final boolean isCollection() { |
aoqi@0 | 131 | return false; |
aoqi@0 | 132 | } |
aoqi@0 | 133 | |
aoqi@0 | 134 | /** |
aoqi@0 | 135 | * Guaranteed to return this. |
aoqi@0 | 136 | */ |
aoqi@0 | 137 | @Deprecated |
aoqi@0 | 138 | public CNonElement getInfo() { |
aoqi@0 | 139 | return this; |
aoqi@0 | 140 | } |
aoqi@0 | 141 | |
aoqi@0 | 142 | public ID idUse() { |
aoqi@0 | 143 | return id; |
aoqi@0 | 144 | } |
aoqi@0 | 145 | |
aoqi@0 | 146 | /** |
aoqi@0 | 147 | * {@link CBuiltinLeafInfo} never has a default associated MIME type. |
aoqi@0 | 148 | */ |
aoqi@0 | 149 | public MimeType getExpectedMimeType() { |
aoqi@0 | 150 | return null; |
aoqi@0 | 151 | } |
aoqi@0 | 152 | |
aoqi@0 | 153 | @Deprecated |
aoqi@0 | 154 | public final CAdapter getAdapterUse() { |
aoqi@0 | 155 | return null; |
aoqi@0 | 156 | } |
aoqi@0 | 157 | |
aoqi@0 | 158 | public Locator getLocator() { |
aoqi@0 | 159 | return Model.EMPTY_LOCATOR; |
aoqi@0 | 160 | } |
aoqi@0 | 161 | |
aoqi@0 | 162 | public final XSComponent getSchemaComponent() { |
aoqi@0 | 163 | throw new UnsupportedOperationException("TODO. If you hit this, let us know."); |
aoqi@0 | 164 | } |
aoqi@0 | 165 | |
aoqi@0 | 166 | /** |
aoqi@0 | 167 | * Creates a {@link TypeUse} that represents a collection of this {@link CBuiltinLeafInfo}. |
aoqi@0 | 168 | */ |
aoqi@0 | 169 | public final TypeUse makeCollection() { |
aoqi@0 | 170 | return TypeUseFactory.makeCollection(this); |
aoqi@0 | 171 | } |
aoqi@0 | 172 | |
aoqi@0 | 173 | /** |
aoqi@0 | 174 | * Creates a {@link TypeUse} that represents an adapted use of this {@link CBuiltinLeafInfo}. |
aoqi@0 | 175 | */ |
aoqi@0 | 176 | public final TypeUse makeAdapted( Class<? extends XmlAdapter> adapter, boolean copy ) { |
aoqi@0 | 177 | return TypeUseFactory.adapt(this,adapter,copy); |
aoqi@0 | 178 | } |
aoqi@0 | 179 | |
aoqi@0 | 180 | /** |
aoqi@0 | 181 | * Creates a {@link TypeUse} that represents a MIME-type assocaited version of this {@link CBuiltinLeafInfo}. |
aoqi@0 | 182 | */ |
aoqi@0 | 183 | public final TypeUse makeMimeTyped( MimeType mt ) { |
aoqi@0 | 184 | return TypeUseFactory.makeMimeTyped(this,mt); |
aoqi@0 | 185 | } |
aoqi@0 | 186 | |
aoqi@0 | 187 | /** |
aoqi@0 | 188 | * @deprecated always return false at this level. |
aoqi@0 | 189 | */ |
aoqi@0 | 190 | public final boolean isElement() { |
aoqi@0 | 191 | return false; |
aoqi@0 | 192 | } |
aoqi@0 | 193 | |
aoqi@0 | 194 | /** |
aoqi@0 | 195 | * @deprecated always return null at this level. |
aoqi@0 | 196 | */ |
aoqi@0 | 197 | public final QName getElementName() { |
aoqi@0 | 198 | return null; |
aoqi@0 | 199 | } |
aoqi@0 | 200 | |
aoqi@0 | 201 | /** |
aoqi@0 | 202 | * @deprecated always return null at this level. |
aoqi@0 | 203 | */ |
aoqi@0 | 204 | public final Element<NType,NClass> asElement() { |
aoqi@0 | 205 | return null; |
aoqi@0 | 206 | } |
aoqi@0 | 207 | |
aoqi@0 | 208 | /** |
aoqi@0 | 209 | * A reference to the representation of the type. |
aoqi@0 | 210 | */ |
aoqi@0 | 211 | public NType getType() { |
aoqi@0 | 212 | return type; |
aoqi@0 | 213 | } |
aoqi@0 | 214 | |
aoqi@0 | 215 | /** |
aoqi@0 | 216 | * Returns all the type names recognized by this bean info. |
aoqi@0 | 217 | * |
aoqi@0 | 218 | * @return |
aoqi@0 | 219 | * do not modify the returned array. |
aoqi@0 | 220 | */ |
aoqi@0 | 221 | public final QName[] getTypeNames() { |
aoqi@0 | 222 | return typeNames; |
aoqi@0 | 223 | } |
aoqi@0 | 224 | |
aoqi@0 | 225 | /** |
aoqi@0 | 226 | * Leaf-type cannot be referenced from IDREF. |
aoqi@0 | 227 | * |
aoqi@0 | 228 | * @deprecated |
aoqi@0 | 229 | * why are you calling a method whose return value is always known? |
aoqi@0 | 230 | */ |
aoqi@0 | 231 | public final boolean canBeReferencedByIDREF() { |
aoqi@0 | 232 | return false; |
aoqi@0 | 233 | } |
aoqi@0 | 234 | |
aoqi@0 | 235 | public QName getTypeName() { |
aoqi@0 | 236 | return typeName; |
aoqi@0 | 237 | } |
aoqi@0 | 238 | |
aoqi@0 | 239 | public Locatable getUpstream() { |
aoqi@0 | 240 | return null; |
aoqi@0 | 241 | } |
aoqi@0 | 242 | |
aoqi@0 | 243 | public Location getLocation() { |
aoqi@0 | 244 | // this isn't very accurate, but it's not too bad |
aoqi@0 | 245 | // doing it correctly need leaves to hold navigator. |
aoqi@0 | 246 | // otherwise revisit the design so that we take navigator as a parameter |
aoqi@0 | 247 | return this; |
aoqi@0 | 248 | } |
aoqi@0 | 249 | |
aoqi@0 | 250 | public boolean isSimpleType() { |
aoqi@0 | 251 | return true; |
aoqi@0 | 252 | } |
aoqi@0 | 253 | |
aoqi@0 | 254 | /** |
aoqi@0 | 255 | * {@link CBuiltinLeafInfo} for Java classes that have |
aoqi@0 | 256 | * the spec defined built-in binding semantics. |
aoqi@0 | 257 | */ |
aoqi@0 | 258 | private static abstract class Builtin extends CBuiltinLeafInfo { |
aoqi@0 | 259 | protected Builtin(Class c, String typeName) { |
aoqi@0 | 260 | this(c,typeName,com.sun.xml.internal.bind.v2.model.core.ID.NONE); |
aoqi@0 | 261 | } |
aoqi@0 | 262 | protected Builtin(Class c, String typeName, ID id) { |
aoqi@0 | 263 | super(NavigatorImpl.theInstance.ref(c), id, new QName(WellKnownNamespace.XML_SCHEMA,typeName)); |
aoqi@0 | 264 | LEAVES.put(getType(),this); |
aoqi@0 | 265 | } |
aoqi@0 | 266 | |
aoqi@0 | 267 | /** |
aoqi@0 | 268 | * No vendor customization in the built-in classes. |
aoqi@0 | 269 | */ |
aoqi@0 | 270 | public CCustomizations getCustomizations() { |
aoqi@0 | 271 | return CCustomizations.EMPTY; |
aoqi@0 | 272 | } |
aoqi@0 | 273 | } |
aoqi@0 | 274 | |
aoqi@0 | 275 | private static final class NoConstantBuiltin extends Builtin { |
aoqi@0 | 276 | public NoConstantBuiltin(Class c, String typeName) { |
aoqi@0 | 277 | super(c, typeName); |
aoqi@0 | 278 | } |
aoqi@0 | 279 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 280 | return null; |
aoqi@0 | 281 | } |
aoqi@0 | 282 | } |
aoqi@0 | 283 | |
aoqi@0 | 284 | /** |
aoqi@0 | 285 | * All built-in leaves. |
aoqi@0 | 286 | */ |
aoqi@0 | 287 | public static final Map<NType,CBuiltinLeafInfo> LEAVES = new HashMap<NType,CBuiltinLeafInfo>(); |
aoqi@0 | 288 | |
aoqi@0 | 289 | |
aoqi@0 | 290 | public static final CBuiltinLeafInfo ANYTYPE = new NoConstantBuiltin(Object.class,"anyType"); |
aoqi@0 | 291 | public static final CBuiltinLeafInfo STRING = new Builtin(String.class,"string") { |
aoqi@0 | 292 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 293 | return JExpr.lit(lexical.value); |
aoqi@0 | 294 | } |
aoqi@0 | 295 | }; |
aoqi@0 | 296 | public static final CBuiltinLeafInfo BOOLEAN = new Builtin(Boolean.class,"boolean") { |
aoqi@0 | 297 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 298 | return JExpr.lit(DatatypeConverter.parseBoolean(lexical.value)); |
aoqi@0 | 299 | } |
aoqi@0 | 300 | }; |
aoqi@0 | 301 | public static final CBuiltinLeafInfo INT = new Builtin(Integer.class,"int") { |
aoqi@0 | 302 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 303 | return JExpr.lit(DatatypeConverter.parseInt(lexical.value)); |
aoqi@0 | 304 | } |
aoqi@0 | 305 | }; |
aoqi@0 | 306 | public static final CBuiltinLeafInfo LONG = new Builtin(Long.class,"long") { |
aoqi@0 | 307 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 308 | return JExpr.lit(DatatypeConverter.parseLong(lexical.value)); |
aoqi@0 | 309 | } |
aoqi@0 | 310 | }; |
aoqi@0 | 311 | public static final CBuiltinLeafInfo BYTE = new Builtin(Byte.class,"byte") { |
aoqi@0 | 312 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 313 | return JExpr.cast( |
aoqi@0 | 314 | outline.getCodeModel().BYTE, |
aoqi@0 | 315 | JExpr.lit(DatatypeConverter.parseByte(lexical.value))); |
aoqi@0 | 316 | } |
aoqi@0 | 317 | }; |
aoqi@0 | 318 | public static final CBuiltinLeafInfo SHORT = new Builtin(Short.class,"short") { |
aoqi@0 | 319 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 320 | return JExpr.cast( |
aoqi@0 | 321 | outline.getCodeModel().SHORT, |
aoqi@0 | 322 | JExpr.lit(DatatypeConverter.parseShort(lexical.value))); |
aoqi@0 | 323 | } |
aoqi@0 | 324 | }; |
aoqi@0 | 325 | public static final CBuiltinLeafInfo FLOAT = new Builtin(Float.class,"float") { |
aoqi@0 | 326 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 327 | return JExpr.lit(DatatypeConverter.parseFloat(lexical.value)); |
aoqi@0 | 328 | } |
aoqi@0 | 329 | }; |
aoqi@0 | 330 | public static final CBuiltinLeafInfo DOUBLE = new Builtin(Double.class,"double") { |
aoqi@0 | 331 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 332 | return JExpr.lit(DatatypeConverter.parseDouble(lexical.value)); |
aoqi@0 | 333 | } |
aoqi@0 | 334 | }; |
aoqi@0 | 335 | public static final CBuiltinLeafInfo QNAME = new Builtin(QName.class,"QName") { |
aoqi@0 | 336 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 337 | QName qn = DatatypeConverter.parseQName(lexical.value,new NamespaceContextAdapter(lexical)); |
aoqi@0 | 338 | return JExpr._new(outline.getCodeModel().ref(QName.class)) |
aoqi@0 | 339 | .arg(qn.getNamespaceURI()) |
aoqi@0 | 340 | .arg(qn.getLocalPart()) |
aoqi@0 | 341 | .arg(qn.getPrefix()); |
aoqi@0 | 342 | } |
aoqi@0 | 343 | }; |
aoqi@0 | 344 | // XMLGregorianCalendar is mutable, so we can't support default values anyhow. |
aoqi@0 | 345 | // For CALENAR we are uses a most unlikely name so as to avoid potential name |
aoqi@0 | 346 | // conflicts in the furture. |
aoqi@0 | 347 | public static final CBuiltinLeafInfo CALENDAR = new NoConstantBuiltin(XMLGregorianCalendar.class,"\u0000"); |
aoqi@0 | 348 | public static final CBuiltinLeafInfo DURATION = new NoConstantBuiltin(Duration.class,"duration"); |
aoqi@0 | 349 | |
aoqi@0 | 350 | public static final CBuiltinLeafInfo BIG_INTEGER = new Builtin(BigInteger.class,"integer") { |
aoqi@0 | 351 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 352 | return JExpr._new(outline.getCodeModel().ref(BigInteger.class)).arg(lexical.value.trim()); |
aoqi@0 | 353 | } |
aoqi@0 | 354 | }; |
aoqi@0 | 355 | |
aoqi@0 | 356 | public static final CBuiltinLeafInfo BIG_DECIMAL = new Builtin(BigDecimal.class,"decimal") { |
aoqi@0 | 357 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 358 | return JExpr._new(outline.getCodeModel().ref(BigDecimal.class)).arg(lexical.value.trim()); |
aoqi@0 | 359 | } |
aoqi@0 | 360 | }; |
aoqi@0 | 361 | |
aoqi@0 | 362 | public static final CBuiltinLeafInfo BASE64_BYTE_ARRAY = new Builtin(byte[].class,"base64Binary") { |
aoqi@0 | 363 | public JExpression createConstant(Outline outline, XmlString lexical) { |
aoqi@0 | 364 | return outline.getCodeModel().ref(DatatypeConverter.class).staticInvoke("parseBase64Binary").arg(lexical.value); |
aoqi@0 | 365 | } |
aoqi@0 | 366 | }; |
aoqi@0 | 367 | |
aoqi@0 | 368 | public static final CBuiltinLeafInfo DATA_HANDLER = new NoConstantBuiltin(DataHandler.class,"base64Binary"); |
aoqi@0 | 369 | public static final CBuiltinLeafInfo IMAGE = new NoConstantBuiltin(Image.class,"base64Binary"); |
aoqi@0 | 370 | public static final CBuiltinLeafInfo XML_SOURCE = new NoConstantBuiltin(Source.class,"base64Binary"); |
aoqi@0 | 371 | |
aoqi@0 | 372 | public static final TypeUse HEXBIN_BYTE_ARRAY = |
aoqi@0 | 373 | STRING.makeAdapted(HexBinaryAdapter.class,false); |
aoqi@0 | 374 | |
aoqi@0 | 375 | |
aoqi@0 | 376 | // TODO: not sure if they should belong here, |
aoqi@0 | 377 | // but I couldn't find other places that fit. |
aoqi@0 | 378 | public static final TypeUse TOKEN = |
aoqi@0 | 379 | STRING.makeAdapted(CollapsedStringAdapter.class,false); |
aoqi@0 | 380 | |
aoqi@0 | 381 | public static final TypeUse NORMALIZED_STRING = |
aoqi@0 | 382 | STRING.makeAdapted(NormalizedStringAdapter.class,false); |
aoqi@0 | 383 | |
aoqi@0 | 384 | public static final TypeUse ID = TypeUseFactory.makeID(TOKEN,com.sun.xml.internal.bind.v2.model.core.ID.ID); |
aoqi@0 | 385 | |
aoqi@0 | 386 | /** |
aoqi@0 | 387 | * boolean restricted to 0 or 1. |
aoqi@0 | 388 | */ |
aoqi@0 | 389 | public static final TypeUse BOOLEAN_ZERO_OR_ONE = |
aoqi@0 | 390 | STRING.makeAdapted(ZeroOneBooleanAdapter.class,true); |
aoqi@0 | 391 | |
aoqi@0 | 392 | /** |
aoqi@0 | 393 | * IDREF. |
aoqi@0 | 394 | * |
aoqi@0 | 395 | * IDREF is has a whitespace normalization semantics of token, but |
aoqi@0 | 396 | * we don't want {@link XmlJavaTypeAdapter} and {@link XmlIDREF} to interact. |
aoqi@0 | 397 | */ |
aoqi@0 | 398 | public static final TypeUse IDREF = TypeUseFactory.makeID(ANYTYPE,com.sun.xml.internal.bind.v2.model.core.ID.IDREF); |
aoqi@0 | 399 | |
aoqi@0 | 400 | /** |
aoqi@0 | 401 | * For all list of strings, such as NMTOKENS, ENTITIES. |
aoqi@0 | 402 | */ |
aoqi@0 | 403 | public static final TypeUse STRING_LIST = |
aoqi@0 | 404 | STRING.makeCollection(); |
aoqi@0 | 405 | } |