public Object set(EStructuralFeature feature, int index, Object value) { if (feature.isMany()) { CDOList list = getList(feature); return list.set(index, value); } return setValue(feature, value); }
public <T> T[] toArray(EStructuralFeature feature, T[] array) { if (!feature.isMany()) { throw new IllegalStateException("!feature.isMany()"); } CDOList list = getList(feature); return list.toArray(array); }
public Object get(EStructuralFeature feature, int index) { if (feature.isMany()) { CDOList list = getList(feature); return list.get(index); } return getValue(feature); }
/** * @see #write(CDODataOutput, int) * @since 3.0 */ public void convertEObjects(CDOIDProvider idProvider) { if (!(containerID instanceof CDOID)) { containerID = idProvider.provideCDOID(containerID); } EStructuralFeature[] features = getAllPersistentFeatures(); for (int i = 0; i < features.length; i++) { EStructuralFeature feature = features[i]; if (feature.isMany()) { CDOList list = getValueAsList(i); if (list != null) { boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature); for (int j = 0; j < list.size(); j++) { Object value = list.get(j, false); EStructuralFeature innerFeature = feature; // Prepare for possible feature map if (isFeatureMap) { Entry entry = (FeatureMap.Entry) value; innerFeature = entry.getEStructuralFeature(); value = entry.getValue(); } if (value != null && innerFeature instanceof EReference) { CDOID newValue = idProvider.provideCDOID(value); if (newValue != value) { list.set(j, newValue); } } } } } else { checkNoFeatureMap(feature); Object value = getValue(i); if (value != null && feature instanceof EReference) { CDOID newValue = idProvider.provideCDOID(value); if (newValue != value) { setValue(i, newValue); } } } } }
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; }
public Object remove(EStructuralFeature feature, int index) { CDOList list = getList(feature); return list.remove(index); }
public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex) { CDOList list = getList(feature); return list.move(targetIndex, sourceIndex); }
public void add(EStructuralFeature feature, int index, Object value) { CDOList list = getList(feature); list.add(index, value); }
public int size(EStructuralFeature feature) { CDOList list = getList(feature); return list.size(); }
public boolean isEmpty(EStructuralFeature feature) { CDOList list = getList(feature); return list.isEmpty(); }
public int lastIndexOf(EStructuralFeature feature, Object value) { CDOList list = getList(feature); return list.lastIndexOf(value); }
public boolean contains(EStructuralFeature feature, Object value) { CDOList list = getList(feature); return list.contains(value); }