Created
December 15, 2021 16:15
-
-
Save chriswk/bac1f1b79267c2f5c40b0769455b08d9 to your computer and use it in GitHub Desktop.
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
public class CustomVersionRangeStrategy implements Strategy { | |
@Override | |
public String getName() { | |
return "CustomVersionStrategy"; | |
} | |
@Override | |
public boolean isEnabled(Map<String, String> parameters) { | |
return false; | |
} | |
@Override | |
public boolean isEnabled(Map<String, String> parameters, UnleashContext unleashContext) { | |
Version minVersion = Version.of(parameters.get("minVersion")); | |
Version maxVersion = Version.of(parameters.get("maxVersion")); | |
Version clientVersion = Version.of(unleashContext.getProperties().get("version")); | |
return clientVersion.lessThanOrEqual(maxVersion) && clientVersion.greaterThanOrEqual(minVersion) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment