Udostępnij przez


EvaluationEvent Class

  • java.lang.Object
    • com.azure.spring.cloud.feature.management.models.EvaluationEvent

public class EvaluationEvent

Event tracking the evaluation of a feature flag. This class captures information about a feature flag evaluation, including which user evaluated it, whether it was enabled, which variant was returned (if any), and the reason for the variant assignment.

Constructor Summary

Constructor Description
EvaluationEvent(FeatureDefinition feature)

Creates an Evaluation Event for the given feature.

Method Summary

Modifier and Type Method and Description
FeatureDefinition getFeature()

Gets the feature flag that was evaluated.

VariantAssignmentReason getReason()

Gets the reason why a particular variant was assigned during this evaluation.

String getUser()

Gets the identifier of the user who evaluated the feature flag.

Variant getVariant()

Gets the variant that was assigned during this feature flag evaluation.

boolean isEnabled()

Determines whether the feature flag was enabled for this evaluation.

EvaluationEvent setEnabled(boolean enabled)

Sets whether the feature flag was enabled for this evaluation.

EvaluationEvent setReason(VariantAssignmentReason reason)

Sets the reason why a particular variant was assigned during this evaluation.

EvaluationEvent setUser(String user)

Sets the identifier of the user who evaluated the feature flag.

EvaluationEvent setVariant(Variant variant)

Sets the variant that was assigned during this feature flag evaluation.

Methods inherited from java.lang.Object

Constructor Details

EvaluationEvent

public EvaluationEvent(FeatureDefinition feature)

Creates an Evaluation Event for the given feature. This constructor initializes a new evaluation event with the specified feature flag, while setting default values for other properties.

Parameters:

feature - The feature flag that is being evaluated

Method Details

getFeature

public FeatureDefinition getFeature()

Gets the feature flag that was evaluated.

Returns:

the feature flag associated with this evaluation event

getReason

public VariantAssignmentReason getReason()

Gets the reason why a particular variant was assigned during this evaluation. This helps track the decision-making process behind the variant selection and can be useful for debugging and analytics.

Returns:

the reason for the variant assignment

getUser

public String getUser()

Gets the identifier of the user who evaluated the feature flag. This is useful for targeting specific users with features and for analytics tracking.

Returns:

the user identifier associated with this evaluation

getVariant

public Variant getVariant()

Gets the variant that was assigned during this feature flag evaluation. This is relevant for feature flags that support multiple variants rather than just being enabled or disabled.

Returns:

the variant assigned for this evaluation, or null if no variant was assigned

isEnabled

public boolean isEnabled()

Determines whether the feature flag was enabled for this evaluation. This indicates the result of the evaluation process for the feature flag.

Returns:

true if the feature flag was enabled, false otherwise

setEnabled

public EvaluationEvent setEnabled(boolean enabled)

Sets whether the feature flag was enabled for this evaluation. This allows recording the result of the feature flag evaluation process.

Parameters:

enabled - true to mark the feature as enabled, false otherwise

Returns:

the updated EvaluationEvent instance for method chaining

setReason

public EvaluationEvent setReason(VariantAssignmentReason reason)

Sets the reason why a particular variant was assigned during this evaluation. This documents the logic behind why a specific variant was chosen, which can be useful for troubleshooting and analytics purposes.

Parameters:

reason - the reason for the variant assignment

Returns:

the updated EvaluationEvent instance for method chaining

setUser

public EvaluationEvent setUser(String user)

Sets the identifier of the user who evaluated the feature flag. This allows tracking which user accessed a particular feature.

Parameters:

user - the user identifier to associate with this evaluation

Returns:

the updated EvaluationEvent instance for method chaining

setVariant

public EvaluationEvent setVariant(Variant variant)

Sets the variant that was assigned during this feature flag evaluation. This allows recording which specific variant of a feature flag was selected when multiple variants are supported.

Parameters:

variant - the variant to associate with this evaluation

Returns:

the updated EvaluationEvent instance for method chaining

Applies to