@@ -455,7 +455,8 @@ else if (userId == null) {
455
455
variableKey ,
456
456
userId ,
457
457
attributes ,
458
- LiveVariable .VariableType .BOOLEAN
458
+ LiveVariable .VariableType .BOOLEAN ,
459
+ defaultValue
459
460
);
460
461
if (variableValue != null ) {
461
462
return Boolean .parseBoolean (variableValue );
@@ -503,7 +504,8 @@ else if (userId == null) {
503
504
variableKey ,
504
505
userId ,
505
506
attributes ,
506
- LiveVariable .VariableType .DOUBLE
507
+ LiveVariable .VariableType .DOUBLE ,
508
+ defaultValue
507
509
);
508
510
if (variableValue != null ) {
509
511
try {
@@ -556,7 +558,8 @@ else if (userId == null) {
556
558
variableKey ,
557
559
userId ,
558
560
attributes ,
559
- LiveVariable .VariableType .INTEGER
561
+ LiveVariable .VariableType .INTEGER ,
562
+ defaultValue
560
563
);
561
564
if (variableValue != null ) {
562
565
try {
@@ -609,7 +612,8 @@ else if (userId == null) {
609
612
variableKey ,
610
613
userId ,
611
614
attributes ,
612
- LiveVariable .VariableType .STRING );
615
+ LiveVariable .VariableType .STRING ,
616
+ defaultValue );
613
617
614
618
if (variableValue != null ) {
615
619
return variableValue ;
@@ -623,7 +627,8 @@ String getFeatureVariableValueForType(@Nonnull String featureKey,
623
627
@ Nonnull String variableKey ,
624
628
@ Nonnull String userId ,
625
629
@ Nonnull Map <String , String > attributes ,
626
- @ Nonnull LiveVariable .VariableType variableType ) {
630
+ @ Nonnull LiveVariable .VariableType variableType ,
631
+ @ Nonnull Object defaultValue ) {
627
632
if (featureKey == null ) {
628
633
logger .warn ("The featureKey parameter must be nonnull." );
629
634
return null ;
@@ -640,15 +645,15 @@ else if (userId == null) {
640
645
if (featureFlag == null ) {
641
646
logger .info ("No feature flag was found for key \" {}\" ." , featureKey );
642
647
logger .info ("Sending event for \" {}\" to trigger feature and variable creation." , featureKey );
643
- sendEventForFeatureAndVariableCreation (featureKey , variableType .getVariableType (), variableKey , userId , attributes );
648
+ sendEventForFeatureAndVariableCreation (featureKey , variableType .getVariableType (), variableKey + ":" + defaultValue . toString () , userId , attributes );
644
649
return null ;
645
650
}
646
651
647
652
LiveVariable variable = featureFlag .getVariableKeyToLiveVariableMap ().get (variableKey );
648
653
if (variable == null ) {
649
654
logger .info ("No feature variable was found for key \" {}\" in feature flag \" {}\" ." ,
650
655
variableKey , featureKey );
651
- sendEventForFeatureAndVariableCreation (featureKey , variableType .getVariableType (), variableKey , userId , attributes );
656
+ sendEventForFeatureAndVariableCreation (featureKey , variableType .getVariableType (), variableKey + ":" + defaultValue . toString () , userId , attributes );
652
657
return null ;
653
658
} else if (!variable .getType ().equals (variableType )) {
654
659
logger .info ("The feature variable \" " + variableKey +
0 commit comments