Generic Entity interface on gwt client side while using GwtQuery

151 views Asked by At

I want to have a simple generic Entity interface pretty much like a map such as on client side in a Gwt + GwtQuery project .

public interface Entity extends JsonBuilder {

    public String JsonObject getProperty(String property) ;

    public Entity setProperty(String name , JsonObject obj ) ;

    public String getPropertyType(String property) /* returns the actual 

}

I want to be able to convert any pojo on server side to a Map form along with some type info and retrieve it on client as an Entity. Entities can be nested.

Is this doable ?

If yes. Please give some detailed guidelines.

To clarify further my goal is to have a single generic Entity interface that is capable of representing varied/diverse types of pojos from server. The type information of such a dynamic entity is expected to be available on the client side as a separate entity.

Do you think the code below will work and serve my purpose ? If yes - how will the json text underneath look like ?

        public interface Tuple extends JsonBuilder {

           public JsonValue get(String name);

           public void set(String name, JsonValue ser);

   }

   public interface Entity extends Tuple {

           public String getType();

           public Tuple[] getTuples();

   }
0

There are 0 answers