@Test public void testDeserialize() throws Exception { Map<String, Object> theData = new HashMap<>(); theData.put("name", "VERDANA"); theData.put("size", "18"); Font theFont = Font.deserialize(theData); assertEquals(Font.FontName.VERDANA, theFont.name); assertEquals(18, theFont.size); }
public static Font deserialize(Map<String, Object> aSerializedData) { String theFontName = (String) aSerializedData.get("name"); String theSize = (String) aSerializedData.get("size"); return new Font(FontName.valueOf(theFontName), Integer.parseInt(theSize)); }
Font implements Distributable { public static Font deserialize(Map<String, Object> aSerializedData) { String theFontName = (String) aSerializedData.get("name"); String theSize = (String) aSerializedData.get("size"); return new Font(FontName.valueOf(theFontName), Integer.parseInt(theSize)); } }
Font implements Distributable { public static Font deserialize(Map<String, Object> aSerializedData) { String theFontName = (String) aSerializedData.get("name"); String theSize = (String) aSerializedData.get("size"); return new Font(FontName.valueOf(theFontName), Integer.parseInt(theSize)); } Font(FontName aFontName, int aSize); }
Font implements Distributable { public static Font deserialize(Map<String, Object> aSerializedData) { String theFontName = (String) aSerializedData.get("name"); String theSize = (String) aSerializedData.get("size"); return new Font(FontName.valueOf(theFontName), Integer.parseInt(theSize)); } Font(FontName aFontName, int aSize); @Override boolean equals(Object o); @Override int hashCode(); Font changeSize(int aSize); Font changeName(FontName aName); @Override Map<String, Object> serialize(); static Font deserialize(Map<String, Object> aSerializedData); }
Font implements Distributable { public static Font deserialize(Map<String, Object> aSerializedData) { String theFontName = (String) aSerializedData.get("name"); String theSize = (String) aSerializedData.get("size"); return new Font(FontName.valueOf(theFontName), Integer.parseInt(theSize)); } Font(FontName aFontName, int aSize); @Override boolean equals(Object o); @Override int hashCode(); Font changeSize(int aSize); Font changeName(FontName aName); @Override Map<String, Object> serialize(); static Font deserialize(Map<String, Object> aSerializedData); static final Font DEFAULT_FONT; final FontName name; final int size; }