Skip to content

Commit e971afa

Browse files
committed
chore: various non-functional refactors
Signed-off-by: Todd Baert <[email protected]>
1 parent dd53021 commit e971afa

File tree

7 files changed

+50
-10
lines changed

7 files changed

+50
-10
lines changed

src/main/java/dev/openfeature/sdk/BooleanHook.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package dev.openfeature.sdk;
22

33
/**
4-
* {@inheritDoc}
4+
* An extension point which can run around flag resolution. They are intended to be used as a way to add custom logic
5+
* to the lifecycle of flag evaluation.
6+
*
7+
* @see Hook
58
*/
69
public interface BooleanHook extends Hook<Boolean> {
710

src/main/java/dev/openfeature/sdk/DoubleHook.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package dev.openfeature.sdk;
22

33
/**
4-
* {@inheritDoc}
4+
* An extension point which can run around flag resolution. They are intended to be used as a way to add custom logic
5+
* to the lifecycle of flag evaluation.
6+
*
7+
* @see Hook
58
*/
69
public interface DoubleHook extends Hook<Double> {
710

src/main/java/dev/openfeature/sdk/ImmutableContext.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import java.util.HashMap;
77
import java.util.Map;
8+
import java.util.function.Function;
89

910
/**
1011
* The EvaluationContext is a container for arbitrary contextual data
@@ -16,8 +17,8 @@
1617
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
1718
public final class ImmutableContext implements EvaluationContext {
1819

19-
@Delegate
20-
private final Structure structure;
20+
@Delegate(excludes = DelegateExclusions.class)
21+
private final ImmutableStructure structure;
2122

2223
/**
2324
* Create an immutable context with an empty targeting_key and attributes provided.
@@ -84,4 +85,14 @@ public EvaluationContext merge(EvaluationContext overridingContext) {
8485
return new ImmutableContext(
8586
this.merge(ImmutableStructure::new, this.asMap(), overridingContext.asMap()));
8687
}
88+
89+
@SuppressWarnings("all")
90+
private static class DelegateExclusions {
91+
public <T extends Structure> Map<String, Value> merge(Function<Map<String, Value>, Structure> newStructure,
92+
Map<String, Value> base,
93+
Map<String, Value> overriding) {
94+
95+
return null;
96+
}
97+
}
8798
}

src/main/java/dev/openfeature/sdk/IntegerHook.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package dev.openfeature.sdk;
22

33
/**
4-
* {@inheritDoc}
4+
* An extension point which can run around flag resolution. They are intended to be used as a way to add custom logic
5+
* to the lifecycle of flag evaluation.
6+
*
7+
* @see Hook
58
*/
69
public interface IntegerHook extends Hook<Integer> {
710

src/main/java/dev/openfeature/sdk/MutableContext.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.HashMap;
99
import java.util.List;
1010
import java.util.Map;
11+
import java.util.function.Function;
1112

1213
/**
1314
* The EvaluationContext is a container for arbitrary contextual data
@@ -20,7 +21,8 @@
2021
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
2122
public class MutableContext implements EvaluationContext {
2223

23-
@Delegate(excludes = HideDelegateAddMethods.class) private final MutableStructure structure;
24+
@Delegate(excludes = DelegateExclusions.class)
25+
private final MutableStructure structure;
2426

2527
public MutableContext() {
2628
this(new HashMap<>());
@@ -124,11 +126,20 @@ public EvaluationContext merge(EvaluationContext overridingContext) {
124126
/**
125127
* Hidden class to tell Lombok not to copy these methods over via delegation.
126128
*/
127-
private static class HideDelegateAddMethods {
129+
@SuppressWarnings("all")
130+
private static class DelegateExclusions {
131+
132+
public <T extends Structure> Map<String, Value> merge(Function<Map<String, Value>, Structure> newStructure,
133+
Map<String, Value> base,
134+
Map<String, Value> overriding) {
135+
136+
return null;
137+
}
138+
128139
public MutableStructure add(String ignoredKey, Boolean ignoredValue) {
129140
return null;
130141
}
131-
142+
132143
public MutableStructure add(String ignoredKey, Double ignoredValue) {
133144
return null;
134145
}

src/main/java/dev/openfeature/sdk/OpenFeatureClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
import lombok.extern.slf4j.Slf4j;
1818

1919
/**
20-
* {@inheritDoc}
20+
* OpenFeature Client implementation.
21+
* You should not instantiate this or reference this class.
22+
* Use the dev.openfeature.sdk.Client interface instead.
23+
* @see Client
24+
*
25+
* @deprecated // TODO: eventually we will make this non-public. See issue #872
2126
*/
2227
@Slf4j
2328
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.BeanMembersShouldSerialize",
2429
"PMD.UnusedLocalVariable", "unchecked", "rawtypes" })
30+
@Deprecated() // TODO: eventually we will make this non-public. See issue #872
2531
public class OpenFeatureClient implements Client {
2632

2733
private final OpenFeatureAPI openfeatureApi;

src/main/java/dev/openfeature/sdk/StringHook.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package dev.openfeature.sdk;
22

33
/**
4-
* {@inheritDoc}
4+
* An extension point which can run around flag resolution. They are intended to be used as a way to add custom logic
5+
* to the lifecycle of flag evaluation.
6+
*
7+
* @see Hook
58
*/
69
public interface StringHook extends Hook<String> {
710

0 commit comments

Comments
 (0)