java - Dynamic Diamond Operator Parameters -
i have next code:
@fxml tableview datatable; for(hashmap column : columns){ string datatype = (string)column.get("data_type"); if(datatype.matches("char|date")){ tablecolumn<string, string> tablecolumn; }else if(datatype.matches("int")){ tablecolumn<string, integer> tablecolumn; }else{ tablecolumn<string, string> tablecolumn; } tablecolumn = new tablecolumn<>((string)column.get("column_name")); datatable.getcolumns().add(tablecolumn); }
what not sure about, diamond operators. sec value of operator alter depending on in database. issue having, says can't find tablecolumn
on line:
tablecolumn = new tablecolumn<>((string)column.get("column_name"));
is there solution allow me have dynamically changing diamond operator parameters?
declare one
tablecolumn<string, object> tablecolumn
and utilize this, maintain track of class of values (according column.get("data_type"). may utilize branch processing when extract values, cast approproate info type.
not elegant, since info of 3 types...
java javafx
No comments:
Post a Comment