Friday, May 5, 2017

Re: JSInterop for Lovefield database

Looks like Lovefield has the concept of a Column so you would also define a Column class. Your Table class would then provide a method to get a Column by name.

Next the docs you linked say that search conditions are defined on an interface called PredicateProvider which a Column implements. So I guess you would do the same in Java / JsInterop as well.

Untested, maybe there are other solutions, haven't done a lot with JsInterop yet:

@JsType(isNative = true)
public class Table {

 
@JsOverlay
 
public Column getColumn(String name) {
   
return JSNIHelper.getProperty(this, name); // You need JSNI here or take a look if jsinterop.base library can help here
 
}
}

@JsType(isNative = true)
public interface PredicateProvider {

 
// eq() can take different parameter types. How to best manage it, take a look at
 
// https://docs.google.com/document/d/14mQeAGQ9M_5uTTUbzRQzCYETA887dTO-xFLtQhgUXXk
 
//
 
// see api: https://github.com/google/lovefield/blob/master/lib/predicate.js
 
Predicate eq(...);

}

@JsType(isNative = true)
public class Column implements PredicateProvider {

 
public native Predicate eq(...);

}




-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment