object JsonToggleMap
ToggleMaps in JSON format.
- Alphabetic
- By Inheritance
- JsonToggleMap
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
sealed abstract
class
DescriptionMode extends AnyRef
How to treat the "description" field on a toggle.
How to treat the "description" field on a toggle.
- See also
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mutableToJson(registry: Map[String, Mutable]): String
Serialize a ToggleMap to JSON format
Serialize a ToggleMap to JSON format
- Note
this is a helper for Java friendliness. Scala users should continue to use
toJson.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
parse(url: URL, descriptionMode: DescriptionMode): Try[ToggleMap]
Attempts to parse the given JSON
URLinto a ToggleMap.Attempts to parse the given JSON
URLinto a ToggleMap.Useful for loading resource files via StandardToggleMap.
The JSON Schema used is:
{ "$schema": "https://json-schema.org/draft-04/schema#", "type": "object", "required": [ "toggles" ], "properties": { "toggles": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "description": { "type": "string" }, "fraction": { "type": "number", "minimum": 0.0, "maximum": 1.0, "exclusiveMinimum": false, "exclusiveMaxmimum": false }, "comment": { "type": "string" } }, "required": [ "id", "fraction" ] } } } }Here is an example of a JSON ToggleMap input:
{ "toggles": [ { "id": "com.game.of.thrones.WargingEnabled", "description": "Use warging for computing the response.", "fraction": 0.1 }, { "id": "com.game.of.thrones.IsWinterComing", "description": "Controls whether or not winter is coming.", "fraction": 1.0, "comment": "We've seen the white walkers, we know that winter is coming." } ] }With the exception of "comment", the properties correspond to the various fields on Toggle.Metadata.
- name: Corresponds to
Toggle.Metadata.id. - fraction: Corresponds to
Toggle.Metadata.fractionand values must be between0.0and1.0, inclusive. - description: Corresponds to
Toggle.Metadata.description. - comment: For documentation purposes only and is not used in the creation of the ToggleMap.
- descriptionMode
how to treat the "description" field for a toggle.
- name: Corresponds to
-
def
parse(json: String, descriptionMode: DescriptionMode): Try[ToggleMap]
Attempts to parse the given JSON
Stringinto a ToggleMap.Attempts to parse the given JSON
Stringinto a ToggleMap.The JSON Schema used is:
{ "$schema": "https://json-schema.org/draft-04/schema#", "type": "object", "required": [ "toggles" ], "properties": { "toggles": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "description": { "type": "string" }, "fraction": { "type": "number", "minimum": 0.0, "maximum": 1.0, "exclusiveMinimum": false, "exclusiveMaxmimum": false }, "comment": { "type": "string" } }, "required": [ "id", "fraction" ] } } } }Here is an example of a JSON ToggleMap input:
{ "toggles": [ { "id": "com.game.of.thrones.WargingEnabled", "description": "Use warging for computing the response.", "fraction": 0.1 }, { "id": "com.game.of.thrones.IsWinterComing", "description": "Controls whether or not winter is coming.", "fraction": 1.0, "comment": "We've seen the white walkers, we know that winter is coming." } ] }With the exception of "comment", the properties correspond to the various fields on Toggle.Metadata.
- name: Corresponds to
Toggle.Metadata.id. - fraction: Corresponds to
Toggle.Metadata.fractionand values must be between0.0and1.0, inclusive. - description: Corresponds to
Toggle.Metadata.description. - comment: For documentation purposes only and is not used in the creation of the ToggleMap.
- descriptionMode
how to treat the "description" field for a toggle.
- name: Corresponds to
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toJson(registry: Map[String, ToggleMap]): String
Serialize a ToggleMap to JSON format
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
object
DescriptionIgnored extends DescriptionMode
Transforms the Toggle's "description" field into being empty.
Transforms the Toggle's "description" field into being empty.
This is useful for service owner overrides of a toggle where the developer making modifications is not the one who has defined the toggle itself.
-
object
DescriptionRequired extends DescriptionMode
Requires toggles to have a "description" field.
Requires toggles to have a "description" field.
This is useful for the library owner's base definitions of Toggle.