Package io.vertx.lang.groovy

## Class VertxExtensionModule

- java.lang.Object
- - io.vertx.lang.groovy.VertxExtensionModule

-     public class VertxExtensionModule
      extends Object

  Extension module for integrating Vert.x common types with Groovy.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `VertxExtensionModule()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static boolean` | `asBoolean​(AsyncResult self)` | Coerces an `AsyncResult` as a boolean value according to Groovy-Truth.
    `static Object` | `asType​(Map map, Class clazz)` | Convert a JSON like map data structure to a Vert.x data object or a `JsonObject`.
    `static Object` | `getAt​(JsonArray json, int idx)` | Subscript operator for `JsonArray`, the read part.
    `static Object` | `getAt​(JsonObject json, String key)` | Subscript operator for `JsonObject`, the read part.
    `static void` | `leftShift​(JsonArray json, Object value)` | `<<` operator for `JsonObject`.
    `static Object` | `putAt​(JsonObject json, String key, Object value)` | Subscript operator for `JsonObject`, the write part.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VertxExtensionModule

          public VertxExtensionModule()

  - ### Method Detail

    - #### asType

          public static Object asType​(Map map,
                                      Class clazz)
                               throws Throwable

      Convert a JSON like map data structure to a Vert.x data object or a `JsonObject`.

      The data object is a class annotated by `DataObject` that provides a public constructor with a `JsonObject` argument.

      Parameters:
        `map` - the JSON like map like data structure
        `clazz` - the target type which can be a Java class annotated with `DataObject` and provides a `JsonObject` constructor, or `JsonObject`
      Returns:
        an instance of the specified `clazz`
      Throws:
        `Throwable`

    - #### getAt

          public static Object getAt​(JsonObject json,
                                     String key)

      Subscript operator for `JsonObject`, the read part.
      Parameters:
        `json` - the json object
        `key` - the key
      Returns:
        the json value for `key`

    - #### putAt

          public static Object putAt​(JsonObject json,
                                     String key,
                                     Object value)

      Subscript operator for `JsonObject`, the write part.
      Parameters:
        `json` - the json object
        `key` - the key
        `value` - the json value
      Returns:
        the previous json value for `key`

    - #### getAt

          public static Object getAt​(JsonArray json,
                                     int idx)

      Subscript operator for `JsonArray`, the read part.
      Parameters:
        `json` - the json array
        `idx` - the idx
      Returns:
        the json value for `idx`

    - #### leftShift

          public static void leftShift​(JsonArray json,
                                       Object value)

      `<<` operator for `JsonObject`.
      Parameters:
        `json` - the json object
        `value` - the json value

    - #### asBoolean

          public static boolean asBoolean​(AsyncResult self)

      Coerces an `AsyncResult` as a boolean value according to Groovy-Truth.
      Parameters:
        `self` - the `AsyncResult` instance
      Returns:
        true if succeeded