1
2
3
4
5
6 package gov.nist.secauto.metaschema.core.model.constraint;
7
8 import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
9 import gov.nist.secauto.metaschema.core.metapath.IMetapathExpression;
10 import gov.nist.secauto.metaschema.core.metapath.MetapathException;
11 import gov.nist.secauto.metaschema.core.model.ISource;
12 import gov.nist.secauto.metaschema.core.model.constraint.impl.DefaultLet;
13 import gov.nist.secauto.metaschema.core.qname.IEnhancedQName;
14
15 import edu.umd.cs.findbugs.annotations.NonNull;
16 import edu.umd.cs.findbugs.annotations.Nullable;
17
18
19
20
21 @SuppressWarnings("PMD.ShortClassName")
22 public interface ILet {
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 @SuppressWarnings("PMD.ShortMethodName")
42 @NonNull
43 @Deprecated(since = "2.2.0", forRemoval = true)
44 static ILet of(
45 @NonNull IEnhancedQName name,
46 @NonNull String valueExpression,
47 @NonNull ISource source,
48 @Nullable MarkupMultiline remarks) {
49 try {
50 return of(
51 name,
52 IMetapathExpression.lazyCompile(valueExpression, source.getStaticContext()),
53 source,
54 remarks);
55 } catch (MetapathException ex) {
56 throw new MetapathException(
57 String.format("Unable to compile the let expression '%s=%s'%s. %s",
58 name,
59 valueExpression,
60 source.getSource() == null ? "" : " in " + source.getSource(),
61 ex.getMessage()),
62 ex);
63 }
64 }
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 @SuppressWarnings("PMD.ShortMethodName")
80 @NonNull
81 static ILet of(
82 @NonNull IEnhancedQName name,
83 @NonNull IMetapathExpression valueExpression,
84 @NonNull ISource source,
85 @Nullable MarkupMultiline remarks) {
86 return new DefaultLet(name, valueExpression, source, remarks);
87 }
88
89
90
91
92
93
94 @NonNull
95 IEnhancedQName getName();
96
97
98
99
100
101
102 @NonNull
103 IMetapathExpression getValueExpression();
104
105
106
107
108
109
110 @NonNull
111 ISource getSource();
112
113
114
115
116
117
118 @Nullable
119 MarkupMultiline getRemarks();
120 }