@Test public final void testSetFromMap() { testGetInstance(); final ServerIdentity serverIdentity = ServerIdentity.getInstance(); final Map<String, Object> map = new HashMap<>(); map.put(MAP_KEYNAME.NAME.name(), "valuemap1"); map.put(MAP_KEYNAME.ROLE.name(), "valuemap2"); map.put(MAP_KEYNAME.SITEID.name(), Long.valueOf(4)); serverIdentity.setFromMap(map); assertEquals("Name still the same", "valuemap1", serverIdentity.getName()); assertEquals("Role still the same", "valuemap2", serverIdentity.getRole()); assertEquals("Pid still the same", 4, serverIdentity.getSiteId()); map.clear(); map.put(MAP_KEYNAME.NAME.name(), "valuemap3"); serverIdentity.setFromMap(map); assertEquals("Name still the same", "valuemap3", serverIdentity.getName()); assertEquals("Role still the same", "valuemap2", serverIdentity.getRole()); assertEquals("Pid still the same", 4, serverIdentity.getSiteId()); map.clear(); map.put(MAP_KEYNAME.ROLE.name(), "valuemap4"); serverIdentity.setFromMap(map); assertEquals("Name still the same", "valuemap3", serverIdentity.getName()); assertEquals("Role still the same", "valuemap4", serverIdentity.getRole()); assertEquals("Pid still the same", 4, serverIdentity.getSiteId()); map.clear(); map.put(MAP_KEYNAME.SITEID.name(), Long.valueOf(6)); serverIdentity.setFromMap(map); assertEquals("Name still the same", "valuemap3", serverIdentity.getName()); assertEquals("Role still the same", "valuemap4", serverIdentity.getRole()); assertEquals("Pid still the same", 6, serverIdentity.getSiteId()); map.clear(); map.put(MAP_KEYNAME.SITEID.name(), "7"); serverIdentity.setFromMap(map); assertEquals("Name still the same", "valuemap3", serverIdentity.getName()); assertEquals("Role still the same", "valuemap4", serverIdentity.getRole()); assertEquals("Pid still the same", 7, serverIdentity.getSiteId()); map.clear(); map.put(MAP_KEYNAME.SITEID.name(), "7a"); serverIdentity.setFromMap(map); assertEquals("Name still the same", "valuemap3", serverIdentity.getName()); assertEquals("Role still the same", "valuemap4", serverIdentity.getRole()); assertEquals("Pid still the same", 7, serverIdentity.getSiteId()); }
@JsonIgnore public final ServerIdentity setFromMap(Map<String, Object> map) { ParametersChecker.checkParameter("map", map); String svalue = getStringFromMap(map, MAP_KEYNAME.NAME.name()); if (svalue != null) { name = svalue; } svalue = getStringFromMap(map, MAP_KEYNAME.ROLE.name()); if (svalue != null) { role = svalue; } final Integer pid = getIntegerFromMap(map, MAP_KEYNAME.SERVERID.name()); if (pid != null) { setServerId(pid.intValue()); } final Integer sId = getIntegerFromMap(map, MAP_KEYNAME.SITEID.name()); if (sId != null) { setSiteId(sId.intValue()); } initializeCommentFormat(); return this; }
ServerIdentity implements ServerIdentityInterface { @JsonIgnore public final ServerIdentity setFromMap(Map<String, Object> map) { ParametersChecker.checkParameter("map", map); String svalue = getStringFromMap(map, MAP_KEYNAME.NAME.name()); if (svalue != null) { name = svalue; } svalue = getStringFromMap(map, MAP_KEYNAME.ROLE.name()); if (svalue != null) { role = svalue; } final Integer pid = getIntegerFromMap(map, MAP_KEYNAME.SERVERID.name()); if (pid != null) { setServerId(pid.intValue()); } final Integer sId = getIntegerFromMap(map, MAP_KEYNAME.SITEID.name()); if (sId != null) { setSiteId(sId.intValue()); } initializeCommentFormat(); return this; } }
ServerIdentity implements ServerIdentityInterface { @JsonIgnore public final ServerIdentity setFromMap(Map<String, Object> map) { ParametersChecker.checkParameter("map", map); String svalue = getStringFromMap(map, MAP_KEYNAME.NAME.name()); if (svalue != null) { name = svalue; } svalue = getStringFromMap(map, MAP_KEYNAME.ROLE.name()); if (svalue != null) { role = svalue; } final Integer pid = getIntegerFromMap(map, MAP_KEYNAME.SERVERID.name()); if (pid != null) { setServerId(pid.intValue()); } final Integer sId = getIntegerFromMap(map, MAP_KEYNAME.SITEID.name()); if (sId != null) { setSiteId(sId.intValue()); } initializeCommentFormat(); return this; } private  ServerIdentity(); }
ServerIdentity implements ServerIdentityInterface { @JsonIgnore public final ServerIdentity setFromMap(Map<String, Object> map) { ParametersChecker.checkParameter("map", map); String svalue = getStringFromMap(map, MAP_KEYNAME.NAME.name()); if (svalue != null) { name = svalue; } svalue = getStringFromMap(map, MAP_KEYNAME.ROLE.name()); if (svalue != null) { role = svalue; } final Integer pid = getIntegerFromMap(map, MAP_KEYNAME.SERVERID.name()); if (pid != null) { setServerId(pid.intValue()); } final Integer sId = getIntegerFromMap(map, MAP_KEYNAME.SITEID.name()); if (sId != null) { setSiteId(sId.intValue()); } initializeCommentFormat(); return this; } private  ServerIdentity(); @JsonIgnore @Override final String getLoggerMessagePrepend(); @JsonIgnore final String getJsonIdentity(); static final ServerIdentity getInstance(); @JsonIgnore final ServerIdentity setFromPropertyFile(File propertiesFile); @JsonIgnore final ServerIdentity setFromYamlFile(File yamlFile); @JsonIgnore final ServerIdentity setFromMap(Map<String, Object> map); @Override final String getName(); final ServerIdentity setName(String name); @Override final String getRole(); final ServerIdentity setRole(String role); @Override final int getGlobalPlatformId(); final ServerIdentity setServerId(int serverId); @Override final int getServerId(); @Override final int getSiteId(); final ServerIdentity setSiteId(int siteId); }
ServerIdentity implements ServerIdentityInterface { @JsonIgnore public final ServerIdentity setFromMap(Map<String, Object> map) { ParametersChecker.checkParameter("map", map); String svalue = getStringFromMap(map, MAP_KEYNAME.NAME.name()); if (svalue != null) { name = svalue; } svalue = getStringFromMap(map, MAP_KEYNAME.ROLE.name()); if (svalue != null) { role = svalue; } final Integer pid = getIntegerFromMap(map, MAP_KEYNAME.SERVERID.name()); if (pid != null) { setServerId(pid.intValue()); } final Integer sId = getIntegerFromMap(map, MAP_KEYNAME.SITEID.name()); if (sId != null) { setSiteId(sId.intValue()); } initializeCommentFormat(); return this; } private  ServerIdentity(); @JsonIgnore @Override final String getLoggerMessagePrepend(); @JsonIgnore final String getJsonIdentity(); static final ServerIdentity getInstance(); @JsonIgnore final ServerIdentity setFromPropertyFile(File propertiesFile); @JsonIgnore final ServerIdentity setFromYamlFile(File yamlFile); @JsonIgnore final ServerIdentity setFromMap(Map<String, Object> map); @Override final String getName(); final ServerIdentity setName(String name); @Override final String getRole(); final ServerIdentity setRole(String role); @Override final int getGlobalPlatformId(); final ServerIdentity setServerId(int serverId); @Override final int getServerId(); @Override final int getSiteId(); final ServerIdentity setSiteId(int siteId);  }