Ejemplo n.º 1
0
  private boolean readValue(
      CDODataInput in, EClass owner, EStructuralFeature[] features, int i, boolean unchunked)
      throws IOException {
    Object value;
    byte unsetState = in.readByte();
    switch (unsetState) {
      case UNSET_OPCODE:
        return unchunked;

      case SET_NULL_OPCODE:
        setValue(i, CDORevisionData.NIL);
        return unchunked;
    }

    EStructuralFeature feature = features[i];
    if (feature.isMany()) {
      CDOList list = in.readCDOList(owner, feature);
      if (unchunked) {
        int size = list.size();
        if (size != 0) {
          Object lastElement = list.get(size - 1);
          if (lastElement == InternalCDOList.UNINITIALIZED
              || lastElement instanceof CDOElementProxy) {
            unchunked = false;
          }
        }
      }

      value = list;
    } else {
      value = in.readCDOFeatureValue(feature);
      if (TRACER.isEnabled()) {
        TRACER.format("Read feature {0}: {1}", feature.getName(), value);
      }
    }

    setValue(i, value);
    return unchunked;
  }