コード例 #1
0
  @Override
  public boolean setValue(Object target, String attrName, Object value, String type) {
    if (JsonIdMap.REMOVE.equals(type) && value != null) {
      attrName = attrName + type;
    }

    if (PaneeleGroove.PROPERTY_LENGTH.equalsIgnoreCase(attrName)) {
      ((PaneeleGroove) target).withLength(Double.parseDouble(value.toString()));
      return true;
    }

    if (PaneeleGroove.PROPERTY_WIDE.equalsIgnoreCase(attrName)) {
      ((PaneeleGroove) target).withWide(Double.parseDouble(value.toString()));
      return true;
    }

    if (PaneeleGroove.PROPERTY_ROOM.equalsIgnoreCase(attrName)) {
      ((PaneeleGroove) target).setRoom((Room) value);
      return true;
    }

    return false;
  }
コード例 #2
0
  @Override
  public Object getValue(Object target, String attrName) {
    int pos = attrName.indexOf('.');
    String attribute = attrName;

    if (pos > 0) {
      attribute = attrName.substring(0, pos);
    }

    if (PaneeleGroove.PROPERTY_LENGTH.equalsIgnoreCase(attribute)) {
      return ((PaneeleGroove) target).getLength();
    }

    if (PaneeleGroove.PROPERTY_WIDE.equalsIgnoreCase(attribute)) {
      return ((PaneeleGroove) target).getWide();
    }

    if (PaneeleGroove.PROPERTY_ROOM.equalsIgnoreCase(attribute)) {
      return ((PaneeleGroove) target).getRoom();
    }

    return null;
  }