public class JsonObject {
private HashMap<String, JsonObject> jsonObjects;
private List<JsonObject> jsonArray;
private Integer jsonNumber;
private String jsonString;
private Boolean jsonBoolean;
private Float jsonFloat;
private String original;
private VIEW view;
@SuppressWarnings("unchecked")
public JsonObject(String json) {
//... json parser to class field
}
<VIEW> void name(VIEW v) {
this.view=v;
}
// ... getter and setters
}
Use Vaadin FW like UI infrastructure. I wont to declare like this:
public class Exm extends FormLayout {
public Exm() {
String json = "{some json ....}";
JsonObject<TextField> js = new JsonObject(json);
js.viewBainder(TextField::getValue,TextField::setValue)
.viewCaption(TextField::setCaption,TextField::getCaption)
.viewValueChangeEvents(TextField::addValueChangeListener);
addComponent(js.getView());
}
}
Can I do this without generic class, only generic method?
How i can bind VIEW and abstract methods in class?
Pls. give simple example.
P.S. I am junior in java pls. dont think in hard ob. me! Thanx.