@@ -120,7 +120,7 @@ Variation activate(@Nonnull String experimentKey,
120120 public @ Nullable
121121 Variation activate (@ Nonnull String experimentKey ,
122122 @ Nonnull String userId ,
123- @ Nonnull Map <String , String > attributes ) throws UnknownExperimentException {
123+ @ Nonnull Map <String , ? > attributes ) throws UnknownExperimentException {
124124
125125 if (experimentKey == null ) {
126126 logger .error ("The experimentKey parameter must be nonnull." );
@@ -153,7 +153,7 @@ Variation activate(@Nonnull Experiment experiment,
153153 public @ Nullable
154154 Variation activate (@ Nonnull Experiment experiment ,
155155 @ Nonnull String userId ,
156- @ Nonnull Map <String , String > attributes ) {
156+ @ Nonnull Map <String , ? > attributes ) {
157157
158158 ProjectConfig currentConfig = getProjectConfig ();
159159
@@ -164,15 +164,15 @@ Variation activate(@Nonnull Experiment experiment,
164164 Variation activate (@ Nonnull ProjectConfig projectConfig ,
165165 @ Nonnull Experiment experiment ,
166166 @ Nonnull String userId ,
167- @ Nonnull Map <String , String > attributes ) {
167+ @ Nonnull Map <String , ? > attributes ) {
168168
169169 if (!validateUserId (userId )){
170170 logger .info ("Not activating user \" {}\" for experiment \" {}\" ." , userId , experiment .getKey ());
171171 return null ;
172172 }
173173 // determine whether all the given attributes are present in the project config. If not, filter out the unknown
174174 // attributes.
175- Map <String , String > filteredAttributes = filterAttributes (projectConfig , attributes );
175+ Map <String , ? > filteredAttributes = filterAttributes (projectConfig , attributes );
176176
177177 // bucket the user to the given experiment and dispatch an impression event
178178 Variation variation = decisionService .getVariation (experiment , userId , filteredAttributes );
@@ -189,7 +189,7 @@ Variation activate(@Nonnull ProjectConfig projectConfig,
189189 private void sendImpression (@ Nonnull ProjectConfig projectConfig ,
190190 @ Nonnull Experiment experiment ,
191191 @ Nonnull String userId ,
192- @ Nonnull Map <String , String > filteredAttributes ,
192+ @ Nonnull Map <String , ? > filteredAttributes ,
193193 @ Nonnull Variation variation ) {
194194 if (experiment .isRunning ()) {
195195 LogEvent impressionEvent = eventFactory .createImpressionEvent (
@@ -228,13 +228,13 @@ public void track(@Nonnull String eventName,
228228
229229 public void track (@ Nonnull String eventName ,
230230 @ Nonnull String userId ,
231- @ Nonnull Map <String , String > attributes ) throws UnknownEventTypeException {
231+ @ Nonnull Map <String , ? > attributes ) throws UnknownEventTypeException {
232232 track (eventName , userId , attributes , Collections .<String , String >emptyMap ());
233233 }
234234
235235 public void track (@ Nonnull String eventName ,
236236 @ Nonnull String userId ,
237- @ Nonnull Map <String , String > attributes ,
237+ @ Nonnull Map <String , ? > attributes ,
238238 @ Nonnull Map <String , ?> eventTags ) throws UnknownEventTypeException {
239239
240240 if (!validateUserId (userId )) {
@@ -259,7 +259,7 @@ public void track(@Nonnull String eventName,
259259
260260 // determine whether all the given attributes are present in the project config. If not, filter out the unknown
261261 // attributes.
262- Map <String , String > filteredAttributes = filterAttributes (currentConfig , attributes );
262+ Map <String , ? > filteredAttributes = filterAttributes (currentConfig , attributes );
263263
264264 if (eventTags == null ) {
265265 logger .warn ("Event tags is null when non-null was expected. Defaulting to an empty event tags map." );
@@ -344,7 +344,7 @@ public void track(@Nonnull String eventName,
344344 */
345345 public @ Nonnull Boolean isFeatureEnabled (@ Nonnull String featureKey ,
346346 @ Nonnull String userId ,
347- @ Nonnull Map <String , String > attributes ) {
347+ @ Nonnull Map <String , ? > attributes ) {
348348 if (featureKey == null ) {
349349 logger .warn ("The featureKey parameter must be nonnull." );
350350 return false ;
@@ -359,7 +359,7 @@ else if (userId == null) {
359359 return false ;
360360 }
361361
362- Map <String , String > filteredAttributes = filterAttributes (projectConfig , attributes );
362+ Map <String , ? > filteredAttributes = filterAttributes (projectConfig , attributes );
363363
364364 FeatureDecision featureDecision = decisionService .getVariationForFeature (featureFlag , userId , filteredAttributes );
365365 if (featureDecision .variation != null ) {
@@ -410,7 +410,7 @@ else if (userId == null) {
410410 public @ Nullable Boolean getFeatureVariableBoolean (@ Nonnull String featureKey ,
411411 @ Nonnull String variableKey ,
412412 @ Nonnull String userId ,
413- @ Nonnull Map <String , String > attributes ) {
413+ @ Nonnull Map <String , ? > attributes ) {
414414 String variableValue = getFeatureVariableValueForType (
415415 featureKey ,
416416 variableKey ,
@@ -450,7 +450,7 @@ else if (userId == null) {
450450 public @ Nullable Double getFeatureVariableDouble (@ Nonnull String featureKey ,
451451 @ Nonnull String variableKey ,
452452 @ Nonnull String userId ,
453- @ Nonnull Map <String , String > attributes ) {
453+ @ Nonnull Map <String , ? > attributes ) {
454454 String variableValue = getFeatureVariableValueForType (
455455 featureKey ,
456456 variableKey ,
@@ -495,7 +495,7 @@ else if (userId == null) {
495495 public @ Nullable Integer getFeatureVariableInteger (@ Nonnull String featureKey ,
496496 @ Nonnull String variableKey ,
497497 @ Nonnull String userId ,
498- @ Nonnull Map <String , String > attributes ) {
498+ @ Nonnull Map <String , ? > attributes ) {
499499 String variableValue = getFeatureVariableValueForType (
500500 featureKey ,
501501 variableKey ,
@@ -540,7 +540,7 @@ else if (userId == null) {
540540 public @ Nullable String getFeatureVariableString (@ Nonnull String featureKey ,
541541 @ Nonnull String variableKey ,
542542 @ Nonnull String userId ,
543- @ Nonnull Map <String , String > attributes ) {
543+ @ Nonnull Map <String , ? > attributes ) {
544544 return getFeatureVariableValueForType (
545545 featureKey ,
546546 variableKey ,
@@ -553,7 +553,7 @@ else if (userId == null) {
553553 String getFeatureVariableValueForType (@ Nonnull String featureKey ,
554554 @ Nonnull String variableKey ,
555555 @ Nonnull String userId ,
556- @ Nonnull Map <String , String > attributes ,
556+ @ Nonnull Map <String , ? > attributes ,
557557 @ Nonnull LiveVariable .VariableType variableType ) {
558558 if (featureKey == null ) {
559559 logger .warn ("The featureKey parameter must be nonnull." );
@@ -614,7 +614,7 @@ else if (userId == null) {
614614 * @return List of the feature keys that are enabled for the user if the userId is empty it will
615615 * return Empty List.
616616 */
617- public List <String > getEnabledFeatures (@ Nonnull String userId , @ Nonnull Map <String , String > attributes ) {
617+ public List <String > getEnabledFeatures (@ Nonnull String userId , @ Nonnull Map <String , ? > attributes ) {
618618 List <String > enabledFeaturesList = new ArrayList <String >();
619619
620620 if (!validateUserId (userId )){
@@ -642,9 +642,9 @@ Variation getVariation(@Nonnull Experiment experiment,
642642 public @ Nullable
643643 Variation getVariation (@ Nonnull Experiment experiment ,
644644 @ Nonnull String userId ,
645- @ Nonnull Map <String , String > attributes ) throws UnknownExperimentException {
645+ @ Nonnull Map <String , ? > attributes ) throws UnknownExperimentException {
646646
647- Map <String , String > filteredAttributes = filterAttributes (projectConfig , attributes );
647+ Map <String , ? > filteredAttributes = filterAttributes (projectConfig , attributes );
648648
649649 return decisionService .getVariation (experiment , userId , filteredAttributes );
650650 }
@@ -659,7 +659,7 @@ Variation getVariation(@Nonnull String experimentKey,
659659 public @ Nullable
660660 Variation getVariation (@ Nonnull String experimentKey ,
661661 @ Nonnull String userId ,
662- @ Nonnull Map <String , String > attributes ) {
662+ @ Nonnull Map <String , ? > attributes ) {
663663 if (!validateUserId (userId )) {
664664 return null ;
665665 }
@@ -677,7 +677,7 @@ Variation getVariation(@Nonnull String experimentKey,
677677 return null ;
678678 }
679679
680- Map <String , String > filteredAttributes = filterAttributes (projectConfig , attributes );
680+ Map <String , ? > filteredAttributes = filterAttributes (projectConfig , attributes );
681681
682682 return decisionService .getVariation (experiment ,userId ,filteredAttributes );
683683 }
@@ -742,17 +742,18 @@ public UserProfileService getUserProfileService() {
742742 * @return the filtered attributes map (containing only attributes that are present in the project config) or an
743743 * empty map if a null attributes object is passed in
744744 */
745- private Map <String , String > filterAttributes (@ Nonnull ProjectConfig projectConfig ,
746- @ Nonnull Map <String , String > attributes ) {
745+ private Map <String , ? > filterAttributes (@ Nonnull ProjectConfig projectConfig ,
746+ @ Nonnull Map <String , ? > attributes ) {
747747 if (attributes == null ) {
748748 logger .warn ("Attributes is null when non-null was expected. Defaulting to an empty attributes map." );
749749 return Collections .<String , String >emptyMap ();
750750 }
751751
752+ // List of attribute keys
752753 List <String > unknownAttributes = null ;
753754
754755 Map <String , Attribute > attributeKeyMapping = projectConfig .getAttributeKeyMapping ();
755- for (Map .Entry <String , String > attribute : attributes .entrySet ()) {
756+ for (Map .Entry <String , ? > attribute : attributes .entrySet ()) {
756757 if (!attributeKeyMapping .containsKey (attribute .getKey ()) &&
757758 !attribute .getKey ().startsWith (ProjectConfig .RESERVED_ATTRIBUTE_PREFIX )) {
758759 if (unknownAttributes == null ) {
@@ -765,7 +766,7 @@ private Map<String, String> filterAttributes(@Nonnull ProjectConfig projectConfi
765766 if (unknownAttributes != null ) {
766767 logger .warn ("Attribute(s) {} not in the datafile." , unknownAttributes );
767768 // make a copy of the passed through attributes, then remove the unknown list
768- attributes = new HashMap <String , String >(attributes );
769+ attributes = new HashMap <>(attributes );
769770 for (String unknownAttribute : unknownAttributes ) {
770771 attributes .remove (unknownAttribute );
771772 }
0 commit comments