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 booleanasBoolean(AsyncResult self)Coerces anAsyncResultas a boolean value according to Groovy-Truth.static ObjectasType(Map map, Class clazz)Convert a JSON like map data structure to a Vert.x data object or aJsonObject.static ObjectgetAt(JsonArray json, int idx)Subscript operator forJsonArray, the read part.static ObjectgetAt(JsonObject json, String key)Subscript operator forJsonObject, the read part.static voidleftShift(JsonArray json, Object value)<<operator forJsonObject.static ObjectputAt(JsonObject json, String key, Object value)Subscript operator forJsonObject, the write part.
-
-
-
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 aJsonObject.The data object is a class annotated by
DataObjectthat provides a public constructor with aJsonObjectargument.- Parameters:
map- the JSON like map like data structureclazz- the target type which can be a Java class annotated withDataObjectand provides aJsonObjectconstructor, orJsonObject- Returns:
- an instance of the specified
clazz - Throws:
Throwable
-
getAt
public static Object getAt(JsonObject json, String key)
Subscript operator forJsonObject, the read part.- Parameters:
json- the json objectkey- the key- Returns:
- the json value for
key
-
putAt
public static Object putAt(JsonObject json, String key, Object value)
Subscript operator forJsonObject, the write part.- Parameters:
json- the json objectkey- the keyvalue- the json value- Returns:
- the previous json value for
key
-
getAt
public static Object getAt(JsonArray json, int idx)
Subscript operator forJsonArray, the read part.- Parameters:
json- the json arrayidx- the idx- Returns:
- the json value for
idx
-
leftShift
public static void leftShift(JsonArray json, Object value)
<<operator forJsonObject.- Parameters:
json- the json objectvalue- the json value
-
asBoolean
public static boolean asBoolean(AsyncResult self)
Coerces anAsyncResultas a boolean value according to Groovy-Truth.- Parameters:
self- theAsyncResultinstance- Returns:
- true if succeeded
-
-