Skip to content

Commit 00db6db

Browse files
authored
Merge branch 'main' into fix/flacky_e2e_tests
2 parents 74e849e + fa23e96 commit 00db6db

File tree

16 files changed

+117
-657
lines changed

16 files changed

+117
-657
lines changed

.github/workflows/merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
2525
- name: Set up JDK 17
26-
uses: actions/setup-java@a7ab372554b6eb1a8eb25e7d9aec1cc9f3ea1a76
26+
uses: actions/setup-java@ead9eaa3cfe0b0fc2fa749519ae09c3d4f4080b0
2727
with:
2828
java-version: '17'
2929
distribution: 'temurin'

.github/workflows/pullrequest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
2323

2424
- name: Set up JDK ${{ matrix.build.java }}
25-
uses: actions/setup-java@a7ab372554b6eb1a8eb25e7d9aec1cc9f3ea1a76
25+
uses: actions/setup-java@ead9eaa3cfe0b0fc2fa749519ae09c3d4f4080b0
2626
with:
2727
java-version: ${{ matrix.build.java }}
2828
distribution: 'temurin'

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
4141

4242
- name: Set up JDK 17
43-
uses: actions/setup-java@a7ab372554b6eb1a8eb25e7d9aec1cc9f3ea1a76
43+
uses: actions/setup-java@ead9eaa3cfe0b0fc2fa749519ae09c3d4f4080b0
4444
with:
4545
java-version: '17'
4646
distribution: 'temurin'

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<!-- used so that lombok can generate suppressions for spotbugs. It needs to find it on the relevant classpath -->
6161
<groupId>com.github.spotbugs</groupId>
6262
<artifactId>spotbugs</artifactId>
63-
<version>4.9.5</version>
63+
<version>4.9.6</version>
6464
<scope>provided</scope>
6565
</dependency>
6666

@@ -348,7 +348,7 @@
348348
</activation>
349349
<build>
350350
<plugins>
351-
<plugin>
351+
<!--<plugin>
352352
<groupId>com.vmlens</groupId>
353353
<artifactId>vmlens-maven-plugin</artifactId>
354354
<version>1.2.14</version>
@@ -363,7 +363,7 @@
363363
</configuration>
364364
</execution>
365365
</executions>
366-
</plugin>
366+
</plugin>-->
367367
<plugin>
368368
<artifactId>maven-dependency-plugin</artifactId>
369369
<version>3.8.1</version>
@@ -457,7 +457,7 @@
457457
<plugin>
458458
<groupId>com.github.spotbugs</groupId>
459459
<artifactId>spotbugs-maven-plugin</artifactId>
460-
<version>4.9.5.0</version>
460+
<version>4.9.6.0</version>
461461
<configuration>
462462
<excludeFilterFile>spotbugs-exclusions.xml</excludeFilterFile>
463463
<plugins>
@@ -473,7 +473,7 @@
473473
<dependency>
474474
<groupId>com.github.spotbugs</groupId>
475475
<artifactId>spotbugs</artifactId>
476-
<version>4.9.5</version>
476+
<version>4.9.6</version>
477477
</dependency>
478478
</dependencies>
479479
<executions>
Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
package dev.openfeature.sdk;
22

3-
import dev.openfeature.sdk.HookContextWithoutData.HookContextWithoutDataBuilder;
3+
import lombok.Builder;
4+
import lombok.NonNull;
5+
import lombok.Value;
6+
import lombok.With;
47

58
/**
6-
* A interface to hold immutable context that {@link Hook} instances use.
9+
* A data class to hold immutable context that {@link Hook} instances use.
10+
*
11+
* @param <T> the type for the flag being evaluated
712
*/
8-
public interface HookContext<T> {
13+
@Value
14+
@Builder
15+
@With
16+
public class HookContext<T> {
17+
@NonNull String flagKey;
18+
19+
@NonNull FlagValueType type;
20+
21+
@NonNull T defaultValue;
22+
23+
@NonNull EvaluationContext ctx;
24+
25+
ClientMetadata clientMetadata;
26+
Metadata providerMetadata;
27+
928
/**
10-
* Builds a {@link HookContextWithoutData} instances from request data.
29+
* Builds a {@link HookContext} instances from request data.
1130
*
1231
* @param key feature flag key
1332
* @param type flag value type
@@ -17,39 +36,21 @@ public interface HookContext<T> {
1736
* @param defaultValue Fallback value
1837
* @param <T> type that the flag is evaluating against
1938
* @return resulting context for hook
20-
* @deprecated this should not be instantiated outside the SDK anymore
2139
*/
22-
@Deprecated
23-
static <T> HookContext<T> from(
40+
public static <T> HookContext<T> from(
2441
String key,
2542
FlagValueType type,
2643
ClientMetadata clientMetadata,
2744
Metadata providerMetadata,
2845
EvaluationContext ctx,
2946
T defaultValue) {
30-
return new HookContextWithoutData<>(key, type, defaultValue, ctx, clientMetadata, providerMetadata);
31-
}
32-
33-
/**
34-
* Returns a builder for our default HookContext object.
35-
*/
36-
static <T> HookContextWithoutDataBuilder<T> builder() {
37-
return HookContextWithoutData.<T>builder();
38-
}
39-
40-
String getFlagKey();
41-
42-
FlagValueType getType();
43-
44-
T getDefaultValue();
45-
46-
EvaluationContext getCtx();
47-
48-
ClientMetadata getClientMetadata();
49-
50-
Metadata getProviderMetadata();
51-
52-
default HookData getHookData() {
53-
return null;
47+
return HookContext.<T>builder()
48+
.flagKey(key)
49+
.type(type)
50+
.clientMetadata(clientMetadata)
51+
.providerMetadata(providerMetadata)
52+
.ctx(ctx)
53+
.defaultValue(defaultValue)
54+
.build();
5455
}
5556
}

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

Lines changed: 0 additions & 50 deletions
This file was deleted.

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

Lines changed: 0 additions & 55 deletions
This file was deleted.

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

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)