-
Notifications
You must be signed in to change notification settings - Fork 188
/
Inheritance.java
35 lines (25 loc) · 1.03 KB
/
Inheritance.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
package com.evolveum.axiom.api.meta;
import com.evolveum.axiom.api.AxiomName;
import com.evolveum.axiom.api.schema.AxiomItemDefinition;
public interface Inheritance {
Inheritance INHERIT = Inheritance::inheritNamespace;
Inheritance NO_CHANGE = Inheritance::noChange;
Inheritance NO_NAMESPACE = Inheritance::noNamespace;
Inheritance CURRENT = NO_CHANGE;
static AxiomName adapt(AxiomName parent, AxiomName child) {
return CURRENT.apply(parent, child);
}
static AxiomName adapt(AxiomName parent, AxiomItemDefinition child) {
return child.inherited() ? adapt(parent, child.name()) : child.name();
}
AxiomName apply(AxiomName parent, AxiomName child);
static AxiomName inheritNamespace(AxiomName parent, AxiomName name) {
return parent.localName(name.localName());
}
static AxiomName noNamespace(AxiomName parent, AxiomName name) {
return name.defaultNamespace();
}
static AxiomName noChange(AxiomName parent, AxiomName name) {
return name;
}
}