-
Notifications
You must be signed in to change notification settings - Fork 188
/
AxiomStatementRule.java
103 lines (55 loc) · 3.23 KB
/
AxiomStatementRule.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.evolveum.axiom.lang.impl;
import com.evolveum.axiom.api.AxiomName;
import com.evolveum.axiom.api.AxiomItem;
import com.evolveum.axiom.api.AxiomValue;
import com.evolveum.axiom.api.schema.AxiomItemDefinition;
import com.evolveum.axiom.api.schema.AxiomTypeDefinition;
import com.evolveum.axiom.lang.api.IdentifierSpaceKey;
import com.evolveum.axiom.lang.spi.AxiomSemanticException;
import com.evolveum.axiom.reactor.Dependency;
public interface AxiomStatementRule<V> {
String name();
boolean isApplicableTo(AxiomItemDefinition definition);
void apply(Lookup<V> context, ActionBuilder<V> action) throws AxiomSemanticException;
interface Lookup<V> {
default AxiomTypeDefinition typeDefinition() {
return itemDefinition().typeDefinition();
}
AxiomItemDefinition itemDefinition();
Dependency<NamespaceContext> namespace(AxiomName name, IdentifierSpaceKey namespaceId);
<T> Dependency<AxiomItem<T>> child(AxiomItemDefinition item, Class<T> valueType);
<T> Dependency<AxiomItem<T>> child(AxiomName item, Class<T> valueType);
<T> Dependency<AxiomValue<T>> onlyItemValue(AxiomItemDefinition item, Class<T> valueType);
Dependency<AxiomValueContext<?>> modify(AxiomName identifierSpace, IdentifierSpaceKey identifier);
Dependency<AxiomValueContext<?>> modify();
Dependency.Search<AxiomValue<?>> global(AxiomName identifierSpace, IdentifierSpaceKey identifier);
Dependency.Search<AxiomValueReference<?>> reference(AxiomName identifierSpace, IdentifierSpaceKey identifier);
Dependency.Search<AxiomValue<?>> namespaceValue(AxiomName space, IdentifierSpaceKey itemName);
Dependency<V> finalValue();
V currentValue();
V originalValue();
boolean isMutable();
Lookup<?> parentValue();
AxiomSemanticException error(String message, Object... arguments);
}
interface ActionBuilder<V> {
AxiomSemanticException error(String message, Object... arguments);
ActionBuilder<V> apply(Action<V> action);
Dependency<AxiomValue<?>> require(AxiomValueContext<?> ext);
<V,X extends Dependency<V>> X require(X req);
/*<V> Optional<V> optionalChildValue(AxiomItemDefinition supertypeReference, Class<V> type);
<V> V requiredChildValue(AxiomItemDefinition supertypeReference, Class<V> type) throws AxiomSemanticException;
V requireValue() throws AxiomSemanticException;
Context<V> errorMessage(Supplier<RuleErrorMessage> errorFactory);
RuleErrorMessage error(String format, Object... arguments);
Optional<V> optionalValue();
Search<AxiomItemValue<?>> requireGlobal(AxiomIdentifier space, IdentifierSpaceKey key);
Dependency<AxiomItemValue<?>> requireChild(AxiomItemDefinition required);
Dependency<NamespaceContext> requireNamespace(AxiomIdentifier name, IdentifierSpaceKey namespaceId);
Dependency<AxiomValueContext<?>> modify(AxiomIdentifier identifierSpace, IdentifierSpaceKey identifier);
Dependency<AxiomItemValue<?>> require(AxiomValueContext<?> ext);*/
}
public interface Action<V> {
void apply(AxiomValueContext<V> context) throws AxiomSemanticException;
}
}