|
1 | 1 | package dev.openfeature.sdk;
|
2 | 2 |
|
3 | 3 | import java.time.Instant;
|
4 |
| -import java.util.*; |
| 4 | +import java.util.HashMap; |
| 5 | +import java.util.List; |
| 6 | +import java.util.Map; |
| 7 | +import java.util.Set; |
5 | 8 | import java.util.stream.Collectors;
|
6 | 9 |
|
7 | 10 | import dev.openfeature.sdk.exceptions.ValueNotConvertableError;
|
@@ -34,55 +37,103 @@ public Set<String> keySet() {
|
34 | 37 | return this.attributes.keySet();
|
35 | 38 | }
|
36 | 39 |
|
37 |
| - // getters |
| 40 | + |
38 | 41 | @Override
|
39 | 42 | public Value getValue(String key) {
|
40 | 43 | return this.attributes.get(key);
|
41 | 44 | }
|
42 | 45 |
|
43 |
| - // adders |
| 46 | + /** |
| 47 | + * Adds the specified value at key. |
| 48 | + * |
| 49 | + * @param key String index |
| 50 | + * @param value Value value |
| 51 | + * @return this structure |
| 52 | + */ |
44 | 53 | public MutableStructure add(String key, Value value) {
|
45 | 54 | attributes.put(key, value);
|
46 | 55 | return this;
|
47 | 56 | }
|
48 | 57 |
|
| 58 | + /** |
| 59 | + * Adds the specified value at key. |
| 60 | + * |
| 61 | + * @param key String index |
| 62 | + * @param value Boolean value |
| 63 | + * @return this structure |
| 64 | + */ |
49 | 65 | public MutableStructure add(String key, Boolean value) {
|
50 | 66 | attributes.put(key, new Value(value));
|
51 | 67 | return this;
|
52 | 68 | }
|
53 | 69 |
|
| 70 | + /** |
| 71 | + * Adds the specified value at key. |
| 72 | + * |
| 73 | + * @param key String index |
| 74 | + * @param value String value |
| 75 | + * @return this structure |
| 76 | + */ |
54 | 77 | public MutableStructure add(String key, String value) {
|
55 | 78 | attributes.put(key, new Value(value));
|
56 | 79 | return this;
|
57 | 80 | }
|
58 | 81 |
|
| 82 | + /** |
| 83 | + * Adds the specified value at key. |
| 84 | + * |
| 85 | + * @param key String index |
| 86 | + * @param value Integer value |
| 87 | + * @return this structure |
| 88 | + */ |
59 | 89 | public MutableStructure add(String key, Integer value) {
|
60 | 90 | attributes.put(key, new Value(value));
|
61 | 91 | return this;
|
62 | 92 | }
|
63 | 93 |
|
| 94 | + /** |
| 95 | + * Adds the specified value at key. |
| 96 | + * |
| 97 | + * @param key String index |
| 98 | + * @param value Double value |
| 99 | + * @return this structure |
| 100 | + */ |
64 | 101 | public MutableStructure add(String key, Double value) {
|
65 | 102 | attributes.put(key, new Value(value));
|
66 | 103 | return this;
|
67 | 104 | }
|
68 | 105 |
|
69 | 106 | /**
|
70 |
| - * Add date-time relevant key. |
| 107 | + * Adds the specified value at key. |
71 | 108 | *
|
72 |
| - * @param key feature key |
73 |
| - * @param value date-time value |
74 |
| - * @return Structure |
| 109 | + * @param key String index |
| 110 | + * @param value Instant value |
| 111 | + * @return this structure |
75 | 112 | */
|
76 | 113 | public MutableStructure add(String key, Instant value) {
|
77 | 114 | attributes.put(key, new Value(value));
|
78 | 115 | return this;
|
79 | 116 | }
|
80 | 117 |
|
| 118 | + /** |
| 119 | + * Adds the specified value at key. |
| 120 | + * |
| 121 | + * @param key String index |
| 122 | + * @param value Structure value |
| 123 | + * @return this structure |
| 124 | + */ |
81 | 125 | public MutableStructure add(String key, Structure value) {
|
82 | 126 | attributes.put(key, new Value(value));
|
83 | 127 | return this;
|
84 | 128 | }
|
85 | 129 |
|
| 130 | + /** |
| 131 | + * Adds the specified value at key. |
| 132 | + * |
| 133 | + * @param key String index |
| 134 | + * @param value List value |
| 135 | + * @return this structure |
| 136 | + */ |
86 | 137 | public <T> MutableStructure add(String key, List<Value> value) {
|
87 | 138 | attributes.put(key, new Value(value));
|
88 | 139 | return this;
|
@@ -116,6 +167,7 @@ public Map<String, Object> asObjectMap() {
|
116 | 167 |
|
117 | 168 | /**
|
118 | 169 | * convertValue is converting the object type Value in a primitive type.
|
| 170 | + * |
119 | 171 | * @param value - Value object to convert
|
120 | 172 | * @return an Object containing the primitive type.
|
121 | 173 | */
|
|
0 commit comments