org.mule.modules.google.api.model
Class BaseWrapper<T>

java.lang.Object
  extended by org.mule.modules.google.api.model.BaseWrapper<T>
Type Parameters:
T -

public abstract class BaseWrapper<T>
extends Object

Generic wrapper for classes that extend GenericJson Because the GenericJson class from Google's client extends Map but still has the structure of a Pojo, Mule's DataMapper cannot handle it as both, Map and Pojo. Implementations of this class wraps this classes allowing DataMapper to treat them as Pojos

Author:
mariano.gonzalez@mulesoft.com

Field Summary
protected  T wrapped
           
 
Constructor Summary
BaseWrapper(T wrapped)
           
 
Method Summary
 T getWrapped()
          Returns the wrapped object
 void setWrapped(T wrapped)
           
static
<G extends com.google.api.client.json.GenericJson,T extends BaseWrapper<?>>
List<G>
unwrapp(Collection<T> models, Class<G> returnClass)
          Returns a new list with the wrapped objects
static
<T extends BaseWrapper<?>,G extends com.google.api.client.json.GenericJson>
List<T>
valueOf(Collection<G> googles, Class<T> returnClass)
          takes a collection of GenericJson and returns a list of wrappers of class returnClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrapped

protected T wrapped
Constructor Detail

BaseWrapper

public BaseWrapper(T wrapped)
Method Detail

valueOf

public static <T extends BaseWrapper<?>,G extends com.google.api.client.json.GenericJson> List<T> valueOf(Collection<G> googles,
                                                                                                          Class<T> returnClass)
takes a collection of GenericJson and returns a list of wrappers of class returnClass

Parameters:
googles - a collection of google objects
returnClass - the class of the objects returned
Returns:
a list of returnClass

unwrapp

public static <G extends com.google.api.client.json.GenericJson,T extends BaseWrapper<?>> List<G> unwrapp(Collection<T> models,
                                                                                                          Class<G> returnClass)
Returns a new list with the wrapped objects

Parameters:
models - the wrappers
returnClass - the return type
Returns:
a list of wrapped objects

getWrapped

public T getWrapped()
Returns the wrapped object

Returns:
the wrapped object

setWrapped

public void setWrapped(T wrapped)


Copyright © 2012. All Rights Reserved.