public TableBean createTableBean(Element tableElement) { TableBean tb = new TableBean(); try { if (tableElement != null) { String name = tableElement.getChild("name").getText(); tb.setName(name); String capacity = tableElement.getChild("capacity").getText(); tb.setCapacity(new Integer(capacity)); String numOfPlayers = tableElement.getChild("numOfPlayers").getText(); tb.setNumOfPlayers(Integer.parseInt(numOfPlayers)); String creator = tableElement.getChild("creator").getText(); tb.setCreator(creator); } } catch (NumberFormatException e) { e.printStackTrace(); } return tb; }
public TableBean createTableBean(Map tableMap) { TableBean tableBean = new TableBean(); Long techkey = (Long) tableMap.get("techkey"); tableBean.setTechkey(techkey); tableBean.setName(tableMap.get("name").toString()); tableBean.setCreator(tableMap.get("creator").toString()); Long numOfPlayers = (Long) tableMap.get("numOfPlayers"); tableBean.setNumOfPlayers(numOfPlayers.intValue()); Long capacity = (Long) tableMap.get("capacity"); tableBean.setCapacity(new Integer(capacity.intValue())); return tableBean; }