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 java.util.List;
20 import java.util.Map;
21
22 import javax.annotation.Nonnull;
23 import javax.annotation.Nullable;
24 import javax.annotation.concurrent.Immutable;
25 import javax.xml.xpath.XPathExpression;
26
27 import com.helger.commons.ValueEnforcer;
28 import com.helger.commons.collection.CollectionHelper;
29 import com.helger.commons.string.ToStringGenerator;
30 import com.helger.schematron.pure.model.PSAssertReport;
31
32
33
34
35
36
37 @Immutable
38 public class PSXPathBoundAssertReport
39 {
40 private final PSAssertReport m_aAssertReport;
41 private final String m_sTestExpression;
42 private final XPathExpression m_aBoundTestExpression;
43 private final List <PSXPathBoundElement> m_aBoundContent;
44 private final Map <String, PSXPathBoundDiagnostic> m_aBoundDiagnostics;
45
46 public PSXPathBoundAssertReport (@Nonnull final PSAssertReport aAssertReport,
47 @Nonnull final String sTestExpression,
48 @Nonnull final XPathExpression aBoundTestExpression,
49 @Nonnull final List <PSXPathBoundElement> aBoundContent,
50 @Nonnull final Map <String, PSXPathBoundDiagnostic> aBoundDiagnostics)
51 {
52 ValueEnforcer.notNull (aAssertReport, "AssertReport");
53 ValueEnforcer.notNull (sTestExpression, "TestExpression");
54 ValueEnforcer.notNull (aBoundTestExpression, "BoundTestExpression");
55 ValueEnforcer.notNull (aBoundContent, "BoundContent");
56 ValueEnforcer.notNull (aBoundDiagnostics, "BoundDiagnostics");
57 m_aAssertReport = aAssertReport;
58 m_sTestExpression = sTestExpression;
59 m_aBoundTestExpression = aBoundTestExpression;
60 m_aBoundContent = aBoundContent;
61 m_aBoundDiagnostics = aBoundDiagnostics;
62 }
63
64
65
66
67 @Nonnull
68 public PSAssertReport getAssertReport ()
69 {
70 return m_aAssertReport;
71 }
72
73
74
75
76
77 @Nonnull
78 public String getTestExpression ()
79 {
80 return m_sTestExpression;
81 }
82
83
84
85
86 @Nonnull
87 public XPathExpression getBoundTestExpression ()
88 {
89 return m_aBoundTestExpression;
90 }
91
92
93
94
95
96 @Nonnull
97 public List <PSXPathBoundElement> getAllBoundContentElements ()
98 {
99 return CollectionHelper.newList (m_aBoundContent);
100 }
101
102
103
104
105
106
107
108
109 @Nullable
110 public PSXPathBoundDiagnostic getBoundDiagnosticOfID (@Nullable final String sID)
111 {
112 return m_aBoundDiagnostics.get (sID);
113 }
114
115 @Override
116 public String toString ()
117 {
118 return new ToStringGenerator (this).append ("assertReport", m_aAssertReport)
119 .append ("testExpression", m_sTestExpression)
120 .append ("boundTestExpression", m_aBoundTestExpression)
121 .append ("boundContent", m_aBoundContent)
122 .append ("boundDiagnostics", m_aBoundDiagnostics)
123 .toString ();
124 }
125 }