Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Axiom: Allow to use any of supertypes as item
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
- Loading branch information
1 parent
ebe83b0
commit 281fa78
Showing
20 changed files
with
259 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,6 @@ public interface AxiomItemContext<T> { | |
|
||
T onlyValue(); | ||
|
||
void addOperationalValue(AxiomValueReference<T> value); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
infra/axiom/src/main/java/com/evolveum/axiom/lang/impl/AxiomValueReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.evolveum.axiom.lang.impl; | ||
|
||
public interface AxiomValueReference<V> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
infra/axiom/src/main/java/com/evolveum/axiom/lang/impl/LazyValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.evolveum.axiom.lang.impl; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Supplier; | ||
|
||
import com.evolveum.axiom.api.AxiomValue; | ||
import com.evolveum.axiom.api.schema.AxiomTypeDefinition; | ||
|
||
class LazyValue<V> implements AxiomValue<V>{ | ||
|
||
private final AxiomTypeDefinition type; | ||
private Object delegate; | ||
|
||
public LazyValue(AxiomTypeDefinition type, Supplier<AxiomValue<V>> supplier) { | ||
this.type = type; | ||
this.delegate = supplier; | ||
} | ||
|
||
@Override | ||
public Optional<AxiomTypeDefinition> type() { | ||
return Optional.of(type); | ||
} | ||
|
||
@Override | ||
public V get() { | ||
if(delegate instanceof AxiomValue) { | ||
return ((AxiomValue<V>) delegate).get(); | ||
} | ||
delegate = ((Supplier<AxiomValue<V>>)delegate).get(); | ||
return get(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.