@Test public void testDeserialize() throws Exception { Map<String, Object> theData = new HashMap<>(); theData.put("uuid", "id"); theData.put("name", "Test"); List<Map<String, Object>> theAnimationSequence = new ArrayList<>(); theAnimationSequence.add(new ResourceName("1").serialize()); theAnimationSequence.add(new ResourceName("2").serialize()); theData.put("animationSequence", theAnimationSequence); Animation theAnimation = Animation.deserialize(theData); assertEquals("id", theAnimation.getUuid()); assertEquals("Test", theAnimation.getName()); assertEquals(2, theAnimation.getSequenceSize()); assertEquals(new ResourceName("1"), theAnimation.getResourceByIndex(0)); assertEquals(new ResourceName("2"), theAnimation.getResourceByIndex(1)); }
public static Animation deserialize(Map<String, Object> aData) { String theName = (String) aData.get("name"); String theUUID = (String) aData.get("uuid"); List<ResourceName> theAnimationSequence = new ArrayList<>(); for (Map<String, Object> theEntry : (List<Map<String, Object>>) aData.get("animationSequence")) { theAnimationSequence.add(ResourceName.deserialize(theEntry)); } return new Animation(theUUID, theName, theAnimationSequence.toArray(new ResourceName[theAnimationSequence.size()])); }
Animation implements Distributable { public static Animation deserialize(Map<String, Object> aData) { String theName = (String) aData.get("name"); String theUUID = (String) aData.get("uuid"); List<ResourceName> theAnimationSequence = new ArrayList<>(); for (Map<String, Object> theEntry : (List<Map<String, Object>>) aData.get("animationSequence")) { theAnimationSequence.add(ResourceName.deserialize(theEntry)); } return new Animation(theUUID, theName, theAnimationSequence.toArray(new ResourceName[theAnimationSequence.size()])); } }
Animation implements Distributable { public static Animation deserialize(Map<String, Object> aData) { String theName = (String) aData.get("name"); String theUUID = (String) aData.get("uuid"); List<ResourceName> theAnimationSequence = new ArrayList<>(); for (Map<String, Object> theEntry : (List<Map<String, Object>>) aData.get("animationSequence")) { theAnimationSequence.add(ResourceName.deserialize(theEntry)); } return new Animation(theUUID, theName, theAnimationSequence.toArray(new ResourceName[theAnimationSequence.size()])); } Animation(String aName); private  Animation(String aUUID, String aName, ResourceName[] aAnimationSequence); }
Animation implements Distributable { public static Animation deserialize(Map<String, Object> aData) { String theName = (String) aData.get("name"); String theUUID = (String) aData.get("uuid"); List<ResourceName> theAnimationSequence = new ArrayList<>(); for (Map<String, Object> theEntry : (List<Map<String, Object>>) aData.get("animationSequence")) { theAnimationSequence.add(ResourceName.deserialize(theEntry)); } return new Animation(theUUID, theName, theAnimationSequence.toArray(new ResourceName[theAnimationSequence.size()])); } Animation(String aName); private  Animation(String aUUID, String aName, ResourceName[] aAnimationSequence); String getName(); String getUuid(); Animation changeName(String aName); Animation addToAnimationSequence(ResourceName aName); Animation removeFromAnimationSequence(ResourceName aName); Animation removeFromAnimationSequence(int aIndex); int getSequenceSize(); ResourceName getResourceByIndex(int aIndex); ResourceName computeCurrentFrame(long aGameTime, Integer aSpeed); @Override Map<String, Object> serialize(); static Animation deserialize(Map<String, Object> aData); }
Animation implements Distributable { public static Animation deserialize(Map<String, Object> aData) { String theName = (String) aData.get("name"); String theUUID = (String) aData.get("uuid"); List<ResourceName> theAnimationSequence = new ArrayList<>(); for (Map<String, Object> theEntry : (List<Map<String, Object>>) aData.get("animationSequence")) { theAnimationSequence.add(ResourceName.deserialize(theEntry)); } return new Animation(theUUID, theName, theAnimationSequence.toArray(new ResourceName[theAnimationSequence.size()])); } Animation(String aName); private  Animation(String aUUID, String aName, ResourceName[] aAnimationSequence); String getName(); String getUuid(); Animation changeName(String aName); Animation addToAnimationSequence(ResourceName aName); Animation removeFromAnimationSequence(ResourceName aName); Animation removeFromAnimationSequence(int aIndex); int getSequenceSize(); ResourceName getResourceByIndex(int aIndex); ResourceName computeCurrentFrame(long aGameTime, Integer aSpeed); @Override Map<String, Object> serialize(); static Animation deserialize(Map<String, Object> aData);  }