for( Entity a : wr.et.map.keySet() ){ System.out.println(a.toString()); System.out.println(wr.et.map.containsKey(a)); }
@Controller @RequestMapping("/apipath") public class SomeController { @RequestMapping(value = "/ajaxJsonPost", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public String postJson(@RequestBody final Entity en) { System.out.println(en.toString()); //assuming you have a class "EntityService" and //it has a method postData //which takes Entity object as parameter and pushes into database. EntityService.postData(en); System.out.println("added"); return "success"; } }
public String toString(){ StringBuilder stringRep = new StringBuilder().append(" Name : " + name + ", dept : " + dept + ", ph num :" + phNum+" "); for(Entity subEntity:entityList){ stringRep.append(subEntity.toString()); } return stringRep.toString(); }
for(Iterator<Map.Entry<String, Entity>> iterator = entities.entrySet().iterator(); iterator.hasNext(); ){ Map.Entry<String, Entity> entry = iterator.next(); String key = entry.getKey(); Entity item = entry.getValue(); if (item.isDestroyed()){ //Notice using an iterator to remove iterator.remove(); ViewManager.getInstance().removeItem(key); //INSTRUCT THE ENTITY TO PERFORM IT'S DESTROYED BEHAVIOR item.Destroyed() } else { item.update(1); ConsoleItem ci = new ConsoleItemImpl(item.getIdentifier(), item.getLocation(), ColorStringConverter.getInstance().StringToColor(item.getSide()), item.getAngle(), item.getShape(), item.toString(), item.isDestroyed(), item.isDamaged()); ViewManager.getInstance().updateItem(ci); } item.update(1); }
final Iterable<Entity> entities = graph.execute(get, user); for (final Entity entity : entities) { log("GET_ENTITIES", entity.toString());