Debian Codegraph @

net/sf/saxon/type/AnyExternalObjectType.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.type;
9
10 import net.sf.saxon.om.Genre;
11 import net.sf.saxon.om.Item;
12 import net.sf.saxon.trans.XPathException;
13 import net.sf.saxon.value.ObjectValue;
14
15 /**
16 * This class represents the type of an external object returned by
17 * an extension function, or supplied as an external variable/parameter.
18 */
19 public class AnyExternalObjectType implements ItemType {
20
21 public static AnyExternalObjectType THE_INSTANCE = new AnyExternalObjectType();
22
23 protected AnyExternalObjectType() {}
24
25 @Override
26 public boolean isAtomicType() {
27 return false;
28 }
29
30 @Override
31 public boolean matches(Item item, TypeHierarchy th) throws XPathException {
32 return item instanceof ObjectValue;
33 }
34
35 @Override
36 public boolean isPlainType() {
37 return false;
38 }
39
40 @Override
41 public int getPrimitiveType() {
42 return -1;
43 }
44
45 /**
46 * Get an alphabetic code representing the type, or at any rate, the nearest built-in type
47 * from which this type is derived. The codes are designed so that for any two built-in types
48 * A and B, alphaCode(A) is a prefix of alphaCode(B) if and only if A is a supertype of B.
49 *
50 * @return the alphacode for the nearest containing built-in type
51 */
52 @Override
53 public String getAlphaCode() {
54 return "E";
55 }
56
57 @Override
58 public String generateJavaScriptItemTypeTest(ItemType knownToBe, int targetVersion) throws XPathException {
59 throw new UnsupportedOperationException();
60 }
61
62 @Override
63 public String generateJavaScriptItemTypeAcceptor(String errorCode, int targetVersion) throws XPathException {
64 throw new UnsupportedOperationException();
65 }
66
67 @Override
68 public ItemType getPrimitiveItemType() {
69 return this;
70 }
71
72 @Override
73 public UType getUType() {
74 return UType.EXTENSION;
75 }
76
77 @Override
78 public AtomicType getAtomizedItemType() {
79 return BuiltInAtomicType.STRING;
80 }
81
82 @Override
83 public boolean isAtomizable(TypeHierarchy th) {
84 return true;
85 }
86
87 @Override
88 public Genre getGenre() {
89 return Genre.EXTERNAL;
90 }
91
92
93
94 }