1 /* |
1 /* |
2 * reserved comment block |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT REMOVE OR ALTER! |
3 * @LastModified: Oct 2017 |
4 */ |
4 */ |
5 /* |
5 /* |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
8 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
19 * limitations under the License. |
19 * limitations under the License. |
20 */ |
20 */ |
21 |
21 |
22 package com.sun.org.apache.xerces.internal.impl.dv.xs; |
22 package com.sun.org.apache.xerces.internal.impl.dv.xs; |
23 |
23 |
24 import java.util.AbstractList; |
|
25 |
|
26 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; |
24 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; |
27 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; |
25 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; |
28 import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList; |
26 import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList; |
|
27 import java.util.AbstractList; |
29 |
28 |
30 /** |
29 /** |
31 * Represent the schema list types |
30 * Represent the schema list types |
32 * |
31 * |
33 * @xerces.internal |
32 * @xerces.internal |
37 * |
36 * |
38 */ |
37 */ |
39 public class ListDV extends TypeValidator{ |
38 public class ListDV extends TypeValidator{ |
40 |
39 |
41 public short getAllowedFacets(){ |
40 public short getAllowedFacets(){ |
42 return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE ); |
41 return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | |
|
42 XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | |
|
43 XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE ); |
43 } |
44 } |
44 |
45 |
45 // this method should never be called: XSSimpleTypeDecl is responsible for |
46 // this method should never be called: XSSimpleTypeDecl is responsible for |
46 // calling the item type for the convertion |
47 // calling the item type for the convertion |
47 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{ |
48 public Object getActualValue(String content, ValidationContext context) |
|
49 throws InvalidDatatypeValueException{ |
48 return content; |
50 return content; |
49 } |
51 } |
50 |
52 |
51 // length of a list type is the number of items in the list |
53 // length of a list type is the number of items in the list |
52 public int getDataLength(Object value) { |
54 public int getDataLength(Object value) { |
53 return ((ListData)value).getLength(); |
55 return ((ListData)value).getLength(); |
54 } |
56 } |
55 |
57 |
56 final static class ListData extends AbstractList implements ObjectList { |
58 final static class ListData extends AbstractList<Object> implements ObjectList { |
57 final Object[] data; |
59 final Object[] data; |
58 private String canonical; |
60 private String canonical; |
59 public ListData(Object[] data) { |
61 public ListData(Object[] data) { |
60 this.data = data; |
62 this.data = data; |
61 } |
63 } |