@@ -97,36 +97,37 @@ public void updateFlag(String flagKey, Flag<?> newFlag) {
97
97
@ Override
98
98
public ProviderEvaluation <Boolean > getBooleanEvaluation (
99
99
String key , Boolean defaultValue , EvaluationContext evaluationContext ) {
100
- return getEvaluation (key , evaluationContext , Boolean .class );
100
+ return getEvaluation (key , defaultValue , evaluationContext , Boolean .class );
101
101
}
102
102
103
103
@ Override
104
104
public ProviderEvaluation <String > getStringEvaluation (
105
105
String key , String defaultValue , EvaluationContext evaluationContext ) {
106
- return getEvaluation (key , evaluationContext , String .class );
106
+ return getEvaluation (key , defaultValue , evaluationContext , String .class );
107
107
}
108
108
109
109
@ Override
110
110
public ProviderEvaluation <Integer > getIntegerEvaluation (
111
111
String key , Integer defaultValue , EvaluationContext evaluationContext ) {
112
- return getEvaluation (key , evaluationContext , Integer .class );
112
+ return getEvaluation (key , defaultValue , evaluationContext , Integer .class );
113
113
}
114
114
115
115
@ Override
116
116
public ProviderEvaluation <Double > getDoubleEvaluation (
117
117
String key , Double defaultValue , EvaluationContext evaluationContext ) {
118
- return getEvaluation (key , evaluationContext , Double .class );
118
+ return getEvaluation (key , defaultValue , evaluationContext , Double .class );
119
119
}
120
120
121
121
@ SneakyThrows
122
122
@ Override
123
123
public ProviderEvaluation <Value > getObjectEvaluation (
124
124
String key , Value defaultValue , EvaluationContext evaluationContext ) {
125
- return getEvaluation (key , evaluationContext , Value .class );
125
+ return getEvaluation (key , defaultValue , evaluationContext , Value .class );
126
126
}
127
127
128
128
private <T > ProviderEvaluation <T > getEvaluation (
129
- String key , EvaluationContext evaluationContext , Class <?> expectedType ) throws OpenFeatureError {
129
+ String key , T defaultValue , EvaluationContext evaluationContext , Class <?> expectedType )
130
+ throws OpenFeatureError {
130
131
if (!ProviderState .READY .equals (state )) {
131
132
if (ProviderState .NOT_READY .equals (state )) {
132
133
throw new ProviderNotReadyError ("provider not yet initialized" );
@@ -140,6 +141,13 @@ private <T> ProviderEvaluation<T> getEvaluation(
140
141
if (flag == null ) {
141
142
throw new FlagNotFoundError ("flag " + key + " not found" );
142
143
}
144
+ if (flag .isDisabled ()) {
145
+ return ProviderEvaluation .<T >builder ()
146
+ .reason (Reason .DISABLED .name ())
147
+ .value (defaultValue )
148
+ .flagMetadata (flag .getFlagMetadata ())
149
+ .build ();
150
+ }
143
151
T value ;
144
152
Reason reason = Reason .STATIC ;
145
153
if (flag .getContextEvaluator () != null ) {
0 commit comments