1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.helger.schematron.pure.bound.xpath;
18
19 import javax.annotation.Nonnull;
20 import javax.annotation.Nullable;
21 import javax.annotation.concurrent.Immutable;
22 import javax.xml.xpath.XPathExpression;
23
24 import com.helger.commons.ValueEnforcer;
25 import com.helger.commons.string.ToStringGenerator;
26 import com.helger.schematron.pure.model.IPSElement;
27
28
29
30
31
32
33
34 @Immutable
35 public class PSXPathBoundElement
36 {
37 private final Object m_aElement;
38 private final String m_sExpression;
39 private final XPathExpression m_aBoundExpression;
40
41 public PSXPathBoundElement (@Nonnull final String sElement)
42 {
43 this (sElement, null, null);
44 }
45
46 public PSXPathBoundElement (@Nonnull final IPSElement aElement)
47 {
48 this (aElement, null, null);
49 }
50
51 public PSXPathBoundElement (@Nonnull final Object aElement,
52 @Nullable final String sExpression,
53 @Nullable final XPathExpression aBoundExpression)
54 {
55 ValueEnforcer.notNull (aElement, "Element");
56 m_aElement = aElement;
57 m_sExpression = sExpression;
58 m_aBoundExpression = aBoundExpression;
59 }
60
61
62
63
64
65 @Nonnull
66 public Object getElement ()
67 {
68 return m_aElement;
69 }
70
71
72
73
74
75
76
77
78 @Nullable
79 public String getExpression ()
80 {
81 return m_sExpression;
82 }
83
84
85
86
87 @Nullable
88 public XPathExpression getBoundExpression ()
89 {
90 return m_aBoundExpression;
91 }
92
93 @Override
94 public String toString ()
95 {
96 return new ToStringGenerator (this).append ("element", m_aElement)
97 .appendIfNotNull ("expression", m_sExpression)
98 .appendIfNotNull ("boundExpression", m_aBoundExpression)
99 .getToString ();
100 }
101 }