1
|
|
/*
|
2
|
|
* JBind
|
3
|
|
*
|
4
|
|
* Copyright (c) by Stefan Wachter. All rights reserved.
|
5
|
|
*
|
6
|
|
* Usage, modification, and redistribution is subject to license terms that are
|
7
|
|
* available at 'http://www.jbind.org'. The JBind license is like the
|
8
|
|
* 'Apache Software License V 1.1'.
|
9
|
|
*/
|
10
|
|
package org.jbind.xml.schema.cmp;
|
11
|
|
|
12
|
|
import org.jbind.xml.core.bridge.IXPath;
|
13
|
|
import org.jbind.xml.core.bridge.IXPathMethod;
|
14
|
|
import org.jbind.xml.core.cmp.ISourceInfo;
|
15
|
|
import org.jbind.xml.core.data.IAnyTypeData;
|
16
|
|
import org.jbind.xml.core.type.IAnyType;
|
17
|
|
|
18
|
|
public class XPathMethod implements IXPathMethod {
|
19
|
|
|
20
|
|
public static class MethodType {
|
21
|
|
|
22
|
|
private String myPrefix;
|
23
|
|
private String myReturnType;
|
24
|
5
|
private MethodType(String aPrefix, String aReturnType) {
|
25
|
5
|
myPrefix = aPrefix;
|
26
|
5
|
myReturnType = aReturnType;
|
27
|
|
}
|
28
|
18
|
public String getPrefix() {
|
29
|
18
|
return myPrefix;
|
30
|
|
}
|
31
|
12
|
private String getReturnType() {
|
32
|
12
|
return myReturnType;
|
33
|
|
}
|
34
|
|
}
|
35
|
|
|
36
|
|
public static final MethodType SELECT = new MethodType("select", "java.util.Iterator");
|
37
|
|
public static final MethodType TEST = new MethodType("test", "boolean");
|
38
|
|
public static final MethodType NUMBER = new MethodType("number", "double");
|
39
|
|
public static final MethodType STRING = new MethodType("string", "String");
|
40
|
|
public static final MethodType FETCH = new MethodType("fetch", IAnyTypeData.class.getName());
|
41
|
|
|
42
|
|
private ISourceInfo mySourceInfo;
|
43
|
|
private String myName;
|
44
|
|
private IXPath myXPath;
|
45
|
|
private MethodType myMethodType;
|
46
|
|
private IAnyType myReferencedType;
|
47
|
|
|
48
|
12
|
public XPathMethod(ISourceInfo aSourceInfo, String aName, IXPath anXPath, MethodType aMethodType, IAnyType aReferencedType) {
|
49
|
12
|
mySourceInfo = aSourceInfo;
|
50
|
12
|
myName = aName;
|
51
|
12
|
myXPath = anXPath;
|
52
|
12
|
myMethodType = aMethodType;
|
53
|
12
|
myReferencedType = aReferencedType;
|
54
|
|
}
|
55
|
|
|
56
|
70
|
public String getName() {
|
57
|
70
|
return myName;
|
58
|
|
}
|
59
|
|
|
60
|
0
|
public ISourceInfo getSourceInfo() {
|
61
|
0
|
return mySourceInfo;
|
62
|
|
}
|
63
|
|
|
64
|
12
|
public IXPath getXPath() {
|
65
|
12
|
return myXPath;
|
66
|
|
}
|
67
|
|
|
68
|
18
|
public String getPrefix() {
|
69
|
18
|
return myMethodType.getPrefix();
|
70
|
|
}
|
71
|
12
|
public String getReturnType() {
|
72
|
12
|
return myMethodType.getReturnType();
|
73
|
|
}
|
74
|
12
|
public IAnyType getReferencedType() {
|
75
|
12
|
return myReferencedType;
|
76
|
|
}
|
77
|
|
}
|
78
|
|
|