@Test public void testGetMapping() { Mapping<TestPerson> mapping = MappingFactory.getMapping(TestPerson.class); MappingSerializer<TestPerson> serializer = new MappingSerializer<>(true); String json = serializer.serialize(mapping); logger.info(json); String file = "MappingFactoryTest__testGetMapping.json"; assertTrue("01", jsonEquals(getClass(), json, file)); }
public static <T extends IDocumentObject> Mapping<T> getMapping(Class<T> type) { @SuppressWarnings("unchecked") Mapping<T> mapping = (Mapping<T>) cache.get(type); if (mapping == null) { mapping = new Mapping<T>(type); addFieldsToDocument(mapping, type, newTree(new HashSet<>(0), type)); cache.put(type, mapping); } return mapping; }
MappingFactory { public static <T extends IDocumentObject> Mapping<T> getMapping(Class<T> type) { @SuppressWarnings("unchecked") Mapping<T> mapping = (Mapping<T>) cache.get(type); if (mapping == null) { mapping = new Mapping<T>(type); addFieldsToDocument(mapping, type, newTree(new HashSet<>(0), type)); cache.put(type, mapping); } return mapping; } }
MappingFactory { public static <T extends IDocumentObject> Mapping<T> getMapping(Class<T> type) { @SuppressWarnings("unchecked") Mapping<T> mapping = (Mapping<T>) cache.get(type); if (mapping == null) { mapping = new Mapping<T>(type); addFieldsToDocument(mapping, type, newTree(new HashSet<>(0), type)); cache.put(type, mapping); } return mapping; } private  MappingFactory(); }
MappingFactory { public static <T extends IDocumentObject> Mapping<T> getMapping(Class<T> type) { @SuppressWarnings("unchecked") Mapping<T> mapping = (Mapping<T>) cache.get(type); if (mapping == null) { mapping = new Mapping<T>(type); addFieldsToDocument(mapping, type, newTree(new HashSet<>(0), type)); cache.put(type, mapping); } return mapping; } private  MappingFactory(); static Mapping<T> getMapping(Class<T> type); }
MappingFactory { public static <T extends IDocumentObject> Mapping<T> getMapping(Class<T> type) { @SuppressWarnings("unchecked") Mapping<T> mapping = (Mapping<T>) cache.get(type); if (mapping == null) { mapping = new Mapping<T>(type); addFieldsToDocument(mapping, type, newTree(new HashSet<>(0), type)); cache.put(type, mapping); } return mapping; } private  MappingFactory(); static Mapping<T> getMapping(Class<T> type);  }