mjj
mjj

Reputation: 21

annotations in gwt

It is possible to create simple annotation for GWT client which give me possibility to use on client side:

@NewAnnotation

myClass myObject

instead of:

myClass myObject=new myClass();

Upvotes: 2

Views: 3769

Answers (1)

BobV
BobV

Reputation: 4173

This is essentially the pattern used by UiBinder. The way to implement this behavior is to write a Generator that produces the glue code to assign values to the fields.

You would be able to write something like:

class MyClass {
  @NewAnnotation
  SomeType field;

  interface MyFieldFiller extends FieldFiller<MyClass> {}
  MyClass() {
    GWT.create(MyFieldFiller.class).populate(this);
  }
}

You might want to look at GIN instead, which already implements a very robust dependency-injection mechanism.

Upvotes: 6

Related Questions