gin

Field level injection with Gin

扶醉桌前 提交于 2019-12-25 02:34:08
问题 I'm trying to do field-level injection so I don't have to pass "models" when my controllers are instantiated, like, UserController controller = new UserController(/*No need to pass models here*/); However my application throws NullPointerException, here my code: UserController.java public class UserController implements Controller { @Inject private UserModel model; public UserController() { model.doSomething(); // NullPointerException } } ClientGinModule.java public class ClientGinModule

Postgres 9.6 - Create unique index for json array

南楼画角 提交于 2019-12-24 03:42:51
问题 'Sup, We have a Postgres (9.6) table myTable with a row data jsonb NOT NULL : DROP TABLE myTable; CREATE TABLE myTable (data jsonb NOT NULL); We want to store object containing an array of email addresses: INSERT INTO myTable (data) VALUES ($${"email": [{"address": "A"}, {"address": "B"}]}$$); INSERT INTO myTable (data) VALUES ($${"email": [{"address": "C"}]}$$); We want to create a unique index on address to prevent insertion of row like: -- "A" NON UNIQUE, SHOULD FAIL INSERT INTO myTable

Pattern matching on jsonb key/value

ぐ巨炮叔叔 提交于 2019-12-17 20:27:30
问题 I am using PostgreSQL 9.4. My table has a jsonb column: CREATE TABLE "PreStage".transaction ( transaction_id serial NOT NULL, transaction jsonb CONSTRAINT pk_transaction PRIMARY KEY (transaction_id) ); CREATE INDEX idxgin ON "PreStage".transaction USING gin (transaction); I store transactions in terms of key / value in the JSONB column. One of the requirements is to search customer name from the key value, hence I am running a query like: SELECT transaction as data FROM "PreStage".transaction

Connecting gwt-dispatch with guice and mvp4g

与世无争的帅哥 提交于 2019-12-13 04:09:23
问题 I have some questions regarding gwt-dispatch and guice. I'm using Guice 2.0, gwt-dispatch 1.1.0 snapshot, mvp4g 1.1.0 and GIN 1.0 First of all, I have defined simple action, result and handler: ListContactsAction.java public class ListContactsAction implements Action<ListContactsResult>{ public ListContactsAction() { } } ListContactsResult.java public class ListContactsResult implements Result { private List<Contact> contactList; public ListContactsResult() { } public ListContactsResult(List

Inject a Class<T> with GIN

有些话、适合烂在心里 提交于 2019-12-12 17:03:51
问题 Is there a way to inject a class type Class<T> in gin? I can't seem to get it working, for example: class GenericFoo<T> { private final Class<T> klass; @Inject public GenericFoo(Class<T> klass) { this.klass = klass; } } class Bar { } with an instance injected somewhere: .. @Inject GenericFoo<Bar> instance; .. and a GinModule containing something along the lines of: bind(new TypeLiteral<Class<Bar>>() {}).to(Bar.class); Thanks 回答1: It's not possible. Reflection is forbidden on the client side,

Adding user class to all presenters

眉间皱痕 提交于 2019-12-12 14:11:49
问题 I have a hazy understanding of GIN, but have it working for injecting presenters, etc. I'm trying to inject a self-made "User" class into all my presenters in order to get the currently logged-in user. I've added @Inject to the constructor on my User class, and added User to my GIN module ... but apart from that, I'm totally lost. Do I bind it to my app presenter (tried that, but I get an error since User doesn't extend my AppPresenter)? As a singleton? Is this even the right way to get pass

GWT Guice/Gin on the server side problem

↘锁芯ラ 提交于 2019-12-11 14:25:18
问题 Hi guys with my question. A GWT project, as i have read Gin i usable only on the client side than Guice is usable on the server side. Here is my question. Let first post some example code. Server side. public class WebchargeServiceImpl extends RemoteServiceServlet implements WebchargeService { @Inject private Injector injector; @Inject private ExecuteOperations executeOperations; ..... executeOperations.do(); .... Here is the injected class ExecuteOperations @Singleton public class

Why is Gin generating source files in the “target/classes” directory?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 08:28:26
问题 I am using Maven to build my GWT project. I am using Gin to generate some boilerplate code: package com.lokur.motd.client.events; import com.gwtplatform.dispatch.annotation.GenEvent; @GenEvent public class EditorChange { } But, when I run "mvn clean install" command, Maven is generating Gin related Java source in the target/classes/com/lokur/motd/client/events directory. Why are there .java files going into the classes directory? I'm using the Maven plug-ins below to generate Java source in

GWT, Guice and GIN compilation

霸气de小男生 提交于 2019-12-11 04:35:29
问题 I'm trying to build and GWT MVP application using Guice and Gin. I added Guice and GIN jars to my Eclipse project but i'm stuck with this error: java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions I've done a quick Google search and here says the we need to recompile GIN against GWT SDK. Also, the Gin Tutorial mention something about a compilation step. Isn't enough to add GIN jars to the GWT project, or is mandatory to generate gin.jar from sources? How do i

Gin wildcard route conflicts with existing children

蓝咒 提交于 2019-12-11 03:03:07
问题 I'd like to build a gin program which serves the following routes: r.GET("/special", ... // Serves a special resource. r.Any("/*", ... // Serves a default resource. However, such a program panics at runtime: [GIN-debug] GET /special --> main.main.func1 (2 handlers) [GIN-debug] GET /* --> main.main.func2 (2 handlers) panic: wildcard route '*' conflicts with existing children in path '/*' Is it possible to create a gin program which serves a default resource for every route except for a single