@Test public void fromObject_shouldCreateSimpleObject() { PersonName name = new PersonName(); name.setGivenName("John"); name.setMiddleName("J"); name.setFamilyName("Johnson"); String [] properties = {"givenName", "middleName", "familyName"}; SimpleObject simpleName = SimpleObject.fromObject(name, ui, properties); Assert.assertEquals("John", simpleName.get("givenName")); Assert.assertEquals("J", simpleName.get("middleName")); Assert.assertEquals("Johnson", simpleName.get("familyName")); }
public static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude) { if (fromObject instanceof Collection) { throw new IllegalArgumentException("Can only be called on an object, not a collection"); } Map<String, Set<String>> propertiesByLevel = splitIntoLevels(propertiesToInclude); return (SimpleObject) fromObjectHelper(fromObject, ui, "", propertiesByLevel); }
SimpleObject extends LinkedHashMap<String, Object> { public static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude) { if (fromObject instanceof Collection) { throw new IllegalArgumentException("Can only be called on an object, not a collection"); } Map<String, Set<String>> propertiesByLevel = splitIntoLevels(propertiesToInclude); return (SimpleObject) fromObjectHelper(fromObject, ui, "", propertiesByLevel); } }
SimpleObject extends LinkedHashMap<String, Object> { public static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude) { if (fromObject instanceof Collection) { throw new IllegalArgumentException("Can only be called on an object, not a collection"); } Map<String, Set<String>> propertiesByLevel = splitIntoLevels(propertiesToInclude); return (SimpleObject) fromObjectHelper(fromObject, ui, "", propertiesByLevel); } SimpleObject();  SimpleObject(OpenmrsMetadata metadata); }
SimpleObject extends LinkedHashMap<String, Object> { public static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude) { if (fromObject instanceof Collection) { throw new IllegalArgumentException("Can only be called on an object, not a collection"); } Map<String, Set<String>> propertiesByLevel = splitIntoLevels(propertiesToInclude); return (SimpleObject) fromObjectHelper(fromObject, ui, "", propertiesByLevel); } SimpleObject();  SimpleObject(OpenmrsMetadata metadata); static SimpleObject create(Object... propertyNamesAndValues); static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude); @SuppressWarnings("unchecked") static List<SimpleObject> fromCollection(Collection<?> fromCollection, UiUtils ui, String... propertiesToInclude); String toJson(); }
SimpleObject extends LinkedHashMap<String, Object> { public static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude) { if (fromObject instanceof Collection) { throw new IllegalArgumentException("Can only be called on an object, not a collection"); } Map<String, Set<String>> propertiesByLevel = splitIntoLevels(propertiesToInclude); return (SimpleObject) fromObjectHelper(fromObject, ui, "", propertiesByLevel); } SimpleObject();  SimpleObject(OpenmrsMetadata metadata); static SimpleObject create(Object... propertyNamesAndValues); static SimpleObject fromObject(Object fromObject, UiUtils ui, String... propertiesToInclude); @SuppressWarnings("unchecked") static List<SimpleObject> fromCollection(Collection<?> fromCollection, UiUtils ui, String... propertiesToInclude); String toJson();  }