Object

com.twitter.finagle.toggle

JsonToggleMap

Related Doc: package toggle

Permalink

object JsonToggleMap

ToggleMaps in JSON format.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonToggleMap
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed abstract class DescriptionMode extends AnyRef

    Permalink

    How to treat the "description" field on a toggle.

    How to treat the "description" field on a toggle.

    See also

    DescriptionIgnored and DescriptionRequired.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object DescriptionIgnored extends DescriptionMode

    Permalink

    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.

  5. object DescriptionRequired extends DescriptionMode

    Permalink

    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.

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. def mutableToJson(registry: Map[String, Mutable]): String

    Permalink

    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.

  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def parse(url: URL, descriptionMode: DescriptionMode): Try[ToggleMap]

    Permalink

    Attempts to parse the given JSON URL into a ToggleMap.

    Attempts to parse the given JSON URL into 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.fraction and values must be between 0.0 and 1.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.

  19. def parse(json: String, descriptionMode: DescriptionMode): Try[ToggleMap]

    Permalink

    Attempts to parse the given JSON String into a ToggleMap.

    Attempts to parse the given JSON String into 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.fraction and values must be between 0.0 and 1.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.

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toJson(registry: Map[String, ToggleMap]): String

    Permalink

    Serialize a ToggleMap to JSON format

  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped