-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bc883c
commit 4ddb301
Showing
6 changed files
with
244 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.spotify.confidence; | ||
|
||
public enum ErrorType { | ||
FLAG_NOT_FOUND, | ||
INVALID_CONTEXT, | ||
INTERNAL_ERROR, | ||
NETWORK_ERROR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.spotify.confidence; | ||
|
||
import java.util.Optional; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
|
||
@Data | ||
@Getter | ||
public class FlagEvaluation<T> { | ||
|
||
public T getValue() { | ||
return value; | ||
} | ||
|
||
private T value; | ||
|
||
@Override | ||
public String toString() { | ||
return "FlagEvaluation{" + | ||
"value=" + value + | ||
", variant='" + variant + '\'' + | ||
", reason='" + reason + '\'' + | ||
", errorType=" + errorType + | ||
", errorMessage='" + errorMessage.orElse("") + '\'' + | ||
'}'; | ||
} | ||
|
||
private String variant; | ||
private String reason; | ||
private Optional<ErrorType> errorType; | ||
private Optional<String> errorMessage; | ||
|
||
public FlagEvaluation(T value, | ||
String variant, String reason, ErrorType errorType, String errorMessage) { | ||
this.value = value; | ||
this.variant = variant; | ||
this.reason = reason; | ||
this.errorType = Optional.of(errorType); | ||
this.errorMessage = Optional.of(errorMessage); | ||
} | ||
|
||
public FlagEvaluation(T value, | ||
String variant, String reason) { | ||
this.value = value; | ||
this.variant = variant; | ||
this.reason = reason; | ||
this.errorType = Optional.empty(); | ||
this.errorMessage = Optional.empty(); | ||
} | ||
} |
Oops, something went wrong.