@Test public void testMapperFieldValue_noPostValue() { LOG.info("testMapperFieldValue_noPostValue()"); Map<String, Object> mapConfigs = new HashMap<>(); MapperFieldValue mapperFieldValue = new MapperFieldValue(); assertFalse("Was able to initialize!", mapperFieldValue.init(null, "someField", null, mapConfigs)); }
@Override public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) { init(inputDesc, fieldName, mapClassCode); if (!(mapConfigs instanceof Map)) { LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName()); return false; } @SuppressWarnings("unchecked") Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs; prevValue = (String) mapObjects.get("pre_value"); newValue = (String) mapObjects.get("post_value"); if (StringUtils.isEmpty(newValue)) { LOG.fatal("Map field value is empty."); return false; } return true; }
MapperFieldValue extends Mapper { @Override public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) { init(inputDesc, fieldName, mapClassCode); if (!(mapConfigs instanceof Map)) { LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName()); return false; } @SuppressWarnings("unchecked") Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs; prevValue = (String) mapObjects.get("pre_value"); newValue = (String) mapObjects.get("post_value"); if (StringUtils.isEmpty(newValue)) { LOG.fatal("Map field value is empty."); return false; } return true; } }
MapperFieldValue extends Mapper { @Override public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) { init(inputDesc, fieldName, mapClassCode); if (!(mapConfigs instanceof Map)) { LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName()); return false; } @SuppressWarnings("unchecked") Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs; prevValue = (String) mapObjects.get("pre_value"); newValue = (String) mapObjects.get("post_value"); if (StringUtils.isEmpty(newValue)) { LOG.fatal("Map field value is empty."); return false; } return true; }  }
MapperFieldValue extends Mapper { @Override public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) { init(inputDesc, fieldName, mapClassCode); if (!(mapConfigs instanceof Map)) { LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName()); return false; } @SuppressWarnings("unchecked") Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs; prevValue = (String) mapObjects.get("pre_value"); newValue = (String) mapObjects.get("post_value"); if (StringUtils.isEmpty(newValue)) { LOG.fatal("Map field value is empty."); return false; } return true; }  @Override boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs); @Override Object apply(Map<String, Object> jsonObj, Object value); }
MapperFieldValue extends Mapper { @Override public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) { init(inputDesc, fieldName, mapClassCode); if (!(mapConfigs instanceof Map)) { LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName()); return false; } @SuppressWarnings("unchecked") Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs; prevValue = (String) mapObjects.get("pre_value"); newValue = (String) mapObjects.get("post_value"); if (StringUtils.isEmpty(newValue)) { LOG.fatal("Map field value is empty."); return false; } return true; }  @Override boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs); @Override Object apply(Map<String, Object> jsonObj, Object value);  }