@@ -97,36 +97,37 @@ public void updateFlag(String flagKey, Flag<?> newFlag) {
9797 @ Override
9898 public ProviderEvaluation <Boolean > getBooleanEvaluation (
9999 String key , Boolean defaultValue , EvaluationContext evaluationContext ) {
100- return getEvaluation (key , evaluationContext , Boolean .class );
100+ return getEvaluation (key , defaultValue , evaluationContext , Boolean .class );
101101 }
102102
103103 @ Override
104104 public ProviderEvaluation <String > getStringEvaluation (
105105 String key , String defaultValue , EvaluationContext evaluationContext ) {
106- return getEvaluation (key , evaluationContext , String .class );
106+ return getEvaluation (key , defaultValue , evaluationContext , String .class );
107107 }
108108
109109 @ Override
110110 public ProviderEvaluation <Integer > getIntegerEvaluation (
111111 String key , Integer defaultValue , EvaluationContext evaluationContext ) {
112- return getEvaluation (key , evaluationContext , Integer .class );
112+ return getEvaluation (key , defaultValue , evaluationContext , Integer .class );
113113 }
114114
115115 @ Override
116116 public ProviderEvaluation <Double > getDoubleEvaluation (
117117 String key , Double defaultValue , EvaluationContext evaluationContext ) {
118- return getEvaluation (key , evaluationContext , Double .class );
118+ return getEvaluation (key , defaultValue , evaluationContext , Double .class );
119119 }
120120
121121 @ SneakyThrows
122122 @ Override
123123 public ProviderEvaluation <Value > getObjectEvaluation (
124124 String key , Value defaultValue , EvaluationContext evaluationContext ) {
125- return getEvaluation (key , evaluationContext , Value .class );
125+ return getEvaluation (key , defaultValue , evaluationContext , Value .class );
126126 }
127127
128128 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 {
130131 if (!ProviderState .READY .equals (state )) {
131132 if (ProviderState .NOT_READY .equals (state )) {
132133 throw new ProviderNotReadyError ("provider not yet initialized" );
@@ -140,6 +141,13 @@ private <T> ProviderEvaluation<T> getEvaluation(
140141 if (flag == null ) {
141142 throw new FlagNotFoundError ("flag " + key + " not found" );
142143 }
144+ if (flag .isDisabled ()) {
145+ return ProviderEvaluation .<T >builder ()
146+ .reason (Reason .DISABLED .name ())
147+ .value (defaultValue )
148+ .flagMetadata (flag .getFlagMetadata ())
149+ .build ();
150+ }
143151 T value ;
144152 Reason reason = Reason .STATIC ;
145153 if (flag .getContextEvaluator () != null ) {
0 commit comments