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.constraint;
|
11
|
|
|
12
|
|
import org.jbind.xml.base.IHasLocation;
|
13
|
|
import org.jbind.xml.base.IRef;
|
14
|
|
import org.jbind.xml.core.constraint.ICheckContext;
|
15
|
|
import org.jbind.xml.core.constraint.IConstraint;
|
16
|
|
import org.jbind.xml.core.constraint.IIdentityConstraint;
|
17
|
|
import org.jbind.xml.core.content.IAttrRefOrDecl;
|
18
|
|
import org.jbind.xml.core.data.IAnyTypeData;
|
19
|
|
import org.jbind.xml.core.type.IAnyType;
|
20
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
21
|
|
|
22
|
|
public abstract class IdentityConstraint extends Constraint implements IIdentityConstraint {
|
23
|
|
|
24
|
|
private IAttrRefOrDecl myDecl = null;
|
25
|
|
private String myNamespace = null;
|
26
|
|
private String myName = null;
|
27
|
|
private IAnyType myDataType = null;
|
28
|
|
|
29
|
20
|
public IdentityConstraint(IAttrRefOrDecl aDecl, IHasLocation aHasLocation) {
|
30
|
20
|
super(aHasLocation);
|
31
|
20
|
myDecl = aDecl;
|
32
|
20
|
myNamespace = aDecl.getGlobalRef().getNamespace();
|
33
|
20
|
myName = aDecl.getGlobalRef().getLocalPart();
|
34
|
|
}
|
35
|
|
|
36
|
16
|
public void localCheck(ICheckContext aCheckContext, IAnyTypeData aData, IConstraintViolations aViolations) {}
|
37
|
|
|
38
|
0
|
public boolean isRestriction(IConstraint aConstraint) {
|
39
|
0
|
return true;
|
40
|
|
}
|
41
|
|
|
42
|
8
|
public IAnyType getDataType() {
|
43
|
8
|
return myDataType;
|
44
|
|
}
|
45
|
|
|
46
|
20
|
public void setDataType(IAnyType aType) {
|
47
|
20
|
myDataType = aType;
|
48
|
|
}
|
49
|
|
|
50
|
16
|
protected IAnyTypeData getAddressedData(IAnyTypeData aData) {
|
51
|
16
|
return aData.getAttribute_(myNamespace, myName);
|
52
|
|
}
|
53
|
|
|
54
|
32
|
public IAttrRefOrDecl getAttrRefOrDecl() {
|
55
|
32
|
return myDecl;
|
56
|
|
}
|
57
|
|
|
58
|
33
|
protected IRef getAttributeRef() {
|
59
|
33
|
return myDecl.getGlobalRef();
|
60
|
|
}
|
61
|
|
|
62
|
|
}
|
63
|
|
|