Class FeatureFlag<T>
java.lang.Object
io.github.projectunified.faststats.featureflag.FeatureFlag<T>
- Type Parameters:
T- the type of the flag value (String, Number, or Boolean)
A feature flag representing a setting or configuration fetched from the FastStats server.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported value types for feature flags. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfetch()Force a fresh fetch of the flag value from the server.Get the current cached flag value.Get the default value for this flag.Get the expiration time for the current cached value.getId()Get the flag identifier.getType()Returns the type representing the value type of this flag.inthashCode()booleanReturns whether the current cached value is expired or absent.booleanisValid()Returns whether the current cached value is still valid.optIn()Request that the server opt in to this flag, then refresh the cached value.optOut()Request that the server opt out of this flag, then refresh the cached value.toString()Return a future that completes with the flag value once it is ready.
-
Method Details
-
getId
-
getType
Returns the type representing the value type of this flag.- Returns:
- the value type
-
getDefaultValue
-
getCached
-
getExpiration
-
isExpired
public boolean isExpired()Returns whether the current cached value is expired or absent.- Returns:
- true if expired or absent, false otherwise
-
isValid
public boolean isValid()Returns whether the current cached value is still valid.- Returns:
- true if valid and not expired, false otherwise
-
whenReady
Return a future that completes with the flag value once it is ready.- Returns:
- a future completing with the flag value
-
fetch
Force a fresh fetch of the flag value from the server.- Returns:
- a future completing with the latest server value
-
optIn
Request that the server opt in to this flag, then refresh the cached value.- Returns:
- a future completing with the updated flag value
-
optOut
Request that the server opt out of this flag, then refresh the cached value.- Returns:
- a future completing with the updated flag value
-
equals
-
hashCode
-
toString
-