public class

KindlingClientUtils

extends Object
java.lang.Object
   ↳ org.mule.module.kindling.client.KindlingClientUtils

Summary

Fields
private static final ObjectMapper jacksonMapper
Public Constructors
KindlingClientUtils()
Public Methods
static JavaType constructKindlingCollectionType(Class<? extends KindlingEntity> classType)
Constructs a JavaType for kindling collections (KindlingCollection\)
static String transformObjectToJson(Object o)
Using ObjectMapper (Jackson) transform an Object to their respective JSON equivalent (String)
static String webResourceCall(WebResource wr, String loggedUser, KindlingWebResourceMethods method)
Method used to eliminate boilerplate handling exceptions when calling get(String) | post(String) | ...
static String webResourceCall(WebResource wr, String loggedUser, KindlingWebResourceMethods method, String requestBody)
Method used to eliminate boilerplate handling exceptions when calling get(String) | post(String) | ...
static <T> T webResourceCallWithClassType(Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method, String requestBody)
static <T> T webResourceCallWithClassType(Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method)
static <T> T webResourceCallWithJavaType(JavaType jtype, Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method)
static <T> T webResourceCallWithJavaType(JavaType jtype, Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method, String requestBody)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private static final ObjectMapper jacksonMapper

Public Constructors

public KindlingClientUtils ()

Public Methods

public static JavaType constructKindlingCollectionType (Class<? extends KindlingEntity> classType)

Constructs a JavaType for kindling collections (KindlingCollection\)

Parameters
classType The type of the class contained in the collection. It must extend from KindlingEntity
Returns

public static String transformObjectToJson (Object o)

Using ObjectMapper (Jackson) transform an Object to their respective JSON equivalent (String)

Parameters
o
Returns
  • The JSON representation of the object (String)
Throws
KindlingConnectorException If for some reason the transformation cannot be acomplished

public static String webResourceCall (WebResource wr, String loggedUser, KindlingWebResourceMethods method)

Method used to eliminate boilerplate handling exceptions when calling get(String) | post(String) | ... from a WebResource

Parameters
wr The WebResource to call get
loggedUser The currently logged user
method The method to use when requesting the resource to the service
Returns
  • The response of the service in an JSON String format

public static String webResourceCall (WebResource wr, String loggedUser, KindlingWebResourceMethods method, String requestBody)

Method used to eliminate boilerplate handling exceptions when calling get(String) | post(String) | ... from a WebResource

Parameters
wr The WebResource to call get
loggedUser The currently logged user
method The method to use when requesting the resource to the service
requestBody If the type is PUT or POST, it can contain data in the body (if the service request it that way)
Returns
  • The response of the service in an JSON String format

public static T webResourceCallWithClassType (Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method, String requestBody)

Parameters
type
wr
loggedUser
method
requestBody

public static T webResourceCallWithClassType (Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method)

Parameters
type
wr
loggedUser
method

public static T webResourceCallWithJavaType (JavaType jtype, Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method)

Parameters
jtype
type
wr
loggedUser
method

public static T webResourceCallWithJavaType (JavaType jtype, Class<T> type, WebResource wr, String loggedUser, KindlingWebResourceMethods method, String requestBody)

Parameters
jtype
type
wr
loggedUser
method
requestBody