how could i create an JavaScriptObject by hand when i have this class
public class Person extends JavaScriptObject{
protected Person(){}
public final native String FirstName()/*-{
return this.firstName;
}-*/;
public final native String LastName()/*-{
return this.lastName;
}-*/;
}
i am asking because i have an array of this JavaScriptObject Peron
public JsArray<Person> persons = JavaScriptObject.createArray().cast();
and i would like to full this array with some of these Person objects
Peson a = new Person();
a.setfirstName(textField1.getText());
a.setLastName(textField2.getText());
persons.push(a)
but i doesnt know how to create such an object by hand. The values of firstName and lastName i would take from an UI component like an textField. Please help!
You should be able to do this?
Person a = (Person)JavaScriptObject.createObject().cast();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With