コード例 #1
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 (SeppelScope.PROPERTY_SCOPENAME.equalsIgnoreCase(attribute)) {
      return ((SeppelScope) target).getScopeName();
    }

    if (SeppelScope.PROPERTY_SUBSCOPES.equalsIgnoreCase(attribute)) {
      return ((SeppelScope) target).getSubScopes();
    }

    if (SeppelScope.PROPERTY_SUPERSCOPES.equalsIgnoreCase(attribute)) {
      return ((SeppelScope) target).getSuperScopes();
    }

    if (SeppelScope.PROPERTY_SPACES.equalsIgnoreCase(attribute)) {
      return ((SeppelScope) target).getSpaces();
    }

    if (SeppelScope.PROPERTY_OBSERVEDOBJECTS.equalsIgnoreCase(attribute)) {
      return ((SeppelScope) target).getObservedObjects();
    }

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

    if (SeppelScope.PROPERTY_SCOPENAME.equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withScopeName((String) value);
      return true;
    }

    if (SeppelScope.PROPERTY_SUBSCOPES.equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withSubScopes((SeppelScope) value);
      return true;
    }

    if ((SeppelScope.PROPERTY_SUBSCOPES + JsonIdMap.REMOVE).equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withoutSubScopes((SeppelScope) value);
      return true;
    }

    if (SeppelScope.PROPERTY_SUPERSCOPES.equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withSuperScopes((SeppelScope) value);
      return true;
    }

    if ((SeppelScope.PROPERTY_SUPERSCOPES + JsonIdMap.REMOVE).equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withoutSuperScopes((SeppelScope) value);
      return true;
    }

    if (SeppelScope.PROPERTY_SPACES.equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withSpaces((SeppelSpaceProxy) value);
      return true;
    }

    if ((SeppelScope.PROPERTY_SPACES + JsonIdMap.REMOVE).equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withoutSpaces((SeppelSpaceProxy) value);
      return true;
    }

    if (SeppelScope.PROPERTY_OBSERVEDOBJECTS.equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withObservedObjects((Object) value);
      return true;
    }

    if ((SeppelScope.PROPERTY_OBSERVEDOBJECTS + JsonIdMap.REMOVE).equalsIgnoreCase(attrName)) {
      ((SeppelScope) target).withoutObservedObjects((Object) value);
      return true;
    }

    return false;
  }