01: package com.sun.xml.xsom;
02:
03: import java.util.List;
04:
05: /**
06: * Identity constraint.
07: *
08: * @author Kohsuke Kawaguchi
09: */
10: public interface XSIdentityConstraint extends XSComponent {
11:
12: /**
13: * Gets the {@link XSElementDecl} that owns this identity constraint.
14: *
15: * @return
16: * never null.
17: */
18: XSElementDecl getParent();
19:
20: /**
21: * Name of the identity constraint.
22: *
23: * A name uniquely identifies this {@link XSIdentityConstraint} within
24: * the namespace.
25: *
26: * @return
27: * never null.
28: */
29: String getName();
30:
31: /**
32: * Target namespace of the identity constraint.
33: *
34: * Just short for <code>getParent().getTargetNamespace()</code>.
35: */
36: String getTargetNamespace();
37:
38: /**
39: * Returns the type of the identity constraint.
40: *
41: * @return
42: * either {@link #KEY},{@link #KEYREF}, or {@link #UNIQUE}.
43: */
44: short getCategory();
45:
46: final short KEY = 0;
47: final short KEYREF = 1;
48: final short UNIQUE = 2;
49:
50: /**
51: * Returns the selector XPath expression as string.
52: *
53: * @return
54: * never null.
55: */
56: XSXPath getSelector();
57:
58: /**
59: * Returns the list of field XPaths.
60: *
61: * @return
62: * a non-empty read-only list of {@link String}s,
63: * each representing the XPath.
64: */
65: List<XSXPath> getFields();
66:
67: /**
68: * If this is {@link #KEYREF}, returns the key {@link XSIdentityConstraint}
69: * being referenced.
70: *
71: * @return
72: * always non-null (when {@link #getCategory()}=={@link #KEYREF}).
73: * @throws IllegalStateException
74: * if {@link #getCategory()}!={@link #KEYREF}
75: */
76: XSIdentityConstraint getReferencedKey();
77: }
|