com.gwtplatform.dispatch.rest.rebind.serialization.JacksonMapperProvider.vm Maven / Gradle / Ivy
package $package;
import javax.inject.Inject;
import javax.inject.Provider;
import com.github.nmorel.gwtjackson.client.ObjectMapper;
import com.google.inject.TypeLiteral;
import com.google.gwt.core.client.GWT;
#if (!$definitions.isEmpty())
import ${package}.mappers.*;
#end
public class $impl extends AbstractJacksonMapperProvider {
$impl() {
#foreach ($definition in $definitions)
registerProvider("$definition.serializableType.getParameterizedQualifiedSourceName()",
new Provider>() {
private ObjectMapper> mapper;
@Override
public ObjectMapper> get() {
if (mapper == null){
mapper = (ObjectMapper>) GWT.create(${definition.className}.class);
}
return mapper;
}
});
#end
}
}