@Override public boolean setValue(Object target, String attrName, Object value, String type) { if (JsonIdMap.REMOVE.equals(type) && value != null) { attrName = attrName + type; } if (SocketThread.PROPERTY_IP.equalsIgnoreCase(attrName)) { ((SocketThread) target).withIp((String) value); return true; } if (SocketThread.PROPERTY_PORT.equalsIgnoreCase(attrName)) { ((SocketThread) target).withPort(Integer.parseInt(value.toString())); return true; } if (SocketThread.PROPERTY_IDMAP.equalsIgnoreCase(attrName)) { ((SocketThread) target).withIdMap((org.sdmlib.serialization.SDMLibJsonIdMap) value); return true; } if (SocketThread.PROPERTY_DEFAULTTARGETTHREAD.equalsIgnoreCase(attrName)) { ((SocketThread) target).withDefaultTargetThread((Object) value); return true; } return false; }
@Override public Object getValue(Object target, String attrName) { int pos = attrName.indexOf('.'); String attribute = attrName; if (pos > 0) { attribute = attrName.substring(0, pos); } if (SocketThread.PROPERTY_IP.equalsIgnoreCase(attribute)) { return ((SocketThread) target).getIp(); } if (SocketThread.PROPERTY_PORT.equalsIgnoreCase(attribute)) { return ((SocketThread) target).getPort(); } if (SocketThread.PROPERTY_IDMAP.equalsIgnoreCase(attribute)) { return ((SocketThread) target).getIdMap(); } if (SocketThread.PROPERTY_DEFAULTTARGETTHREAD.equalsIgnoreCase(attribute)) { return ((SocketThread) target).getDefaultTargetThread(); } return null; }