diff options
author | 2022-11-10 17:25:24 +0100 | |
---|---|---|
committer | 2022-11-10 17:25:24 +0100 | |
commit | fbd2f59a86d8dbd54dae50ca3c3e27d0642d5806 (patch) | |
tree | 8430a24c3cdfaf9f07035a56f584055f1e65e8e4 /subprojects/store/src/main | |
parent | feat(web): backend URL configuration (diff) | |
download | refinery-fbd2f59a86d8dbd54dae50ca3c3e27d0642d5806.tar.gz refinery-fbd2f59a86d8dbd54dae50ca3c3e27d0642d5806.tar.zst refinery-fbd2f59a86d8dbd54dae50ca3c3e27d0642d5806.zip |
feat(store): DataRepresentation reflective type
Diffstat (limited to 'subprojects/store/src/main')
3 files changed, 21 insertions, 6 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/representation/AuxiliaryData.java b/subprojects/store/src/main/java/tools/refinery/store/model/representation/AuxiliaryData.java index 1a968f50..18c38151 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/representation/AuxiliaryData.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/representation/AuxiliaryData.java | |||
@@ -5,8 +5,9 @@ import tools.refinery.store.map.ContinousHashProvider; | |||
5 | public final class AuxiliaryData<K, V> extends DataRepresentation<K, V> { | 5 | public final class AuxiliaryData<K, V> extends DataRepresentation<K, V> { |
6 | private final ContinousHashProvider<K> hashProvider; | 6 | private final ContinousHashProvider<K> hashProvider; |
7 | 7 | ||
8 | public AuxiliaryData(String name, ContinousHashProvider<K> hashProvider, V defaultValue) { | 8 | public AuxiliaryData(String name, Class<K> keyType, ContinousHashProvider<K> hashProvider, Class<V> valueType, |
9 | super(name, defaultValue); | 9 | V defaultValue) { |
10 | super(name, keyType, valueType, defaultValue); | ||
10 | this.hashProvider = hashProvider; | 11 | this.hashProvider = hashProvider; |
11 | } | 12 | } |
12 | 13 | ||
diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/representation/DataRepresentation.java b/subprojects/store/src/main/java/tools/refinery/store/model/representation/DataRepresentation.java index 49f74717..61c6291b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/representation/DataRepresentation.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/representation/DataRepresentation.java | |||
@@ -7,9 +7,15 @@ public abstract sealed class DataRepresentation<K, V> permits Relation, Auxiliar | |||
7 | 7 | ||
8 | private final V defaultValue; | 8 | private final V defaultValue; |
9 | 9 | ||
10 | protected DataRepresentation(String name, V defaultValue) { | 10 | private final Class<K> keyType; |
11 | |||
12 | private final Class<V> valueType; | ||
13 | |||
14 | protected DataRepresentation(String name, Class<K> keyType, Class<V> valueType, V defaultValue) { | ||
11 | this.name = name; | 15 | this.name = name; |
12 | this.defaultValue = defaultValue; | 16 | this.defaultValue = defaultValue; |
17 | this.keyType = keyType; | ||
18 | this.valueType = valueType; | ||
13 | } | 19 | } |
14 | 20 | ||
15 | public String getName() { | 21 | public String getName() { |
@@ -23,4 +29,12 @@ public abstract sealed class DataRepresentation<K, V> permits Relation, Auxiliar | |||
23 | public V getDefaultValue() { | 29 | public V getDefaultValue() { |
24 | return defaultValue; | 30 | return defaultValue; |
25 | } | 31 | } |
32 | |||
33 | public Class<K> getKeyType() { | ||
34 | return keyType; | ||
35 | } | ||
36 | |||
37 | public Class<V> getValueType() { | ||
38 | return valueType; | ||
39 | } | ||
26 | } | 40 | } |
diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/representation/Relation.java b/subprojects/store/src/main/java/tools/refinery/store/model/representation/Relation.java index 2e21ea37..cc32257c 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/representation/Relation.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/representation/Relation.java | |||
@@ -2,14 +2,14 @@ package tools.refinery.store.model.representation; | |||
2 | 2 | ||
3 | import tools.refinery.store.map.ContinousHashProvider; | 3 | import tools.refinery.store.map.ContinousHashProvider; |
4 | import tools.refinery.store.model.RelationLike; | 4 | import tools.refinery.store.model.RelationLike; |
5 | import tools.refinery.store.tuple.Tuple; | ||
6 | import tools.refinery.store.model.TupleHashProvider; | 5 | import tools.refinery.store.model.TupleHashProvider; |
6 | import tools.refinery.store.tuple.Tuple; | ||
7 | 7 | ||
8 | public final class Relation<D> extends DataRepresentation<Tuple, D> implements RelationLike { | 8 | public final class Relation<D> extends DataRepresentation<Tuple, D> implements RelationLike { |
9 | private final int arity; | 9 | private final int arity; |
10 | 10 | ||
11 | public Relation(String name, int arity, D defaultValue) { | 11 | public Relation(String name, int arity, Class<D> valueType, D defaultValue) { |
12 | super(name, defaultValue); | 12 | super(name, Tuple.class, valueType, defaultValue); |
13 | this.arity = arity; | 13 | this.arity = arity; |
14 | } | 14 | } |
15 | 15 | ||