Refine search
protected Optional<String> optionalAttribute(String... attributeIds) { if (element.getAnyAttribute().isEmpty()) { return Optional.empty(); } final List<String> attributes = Arrays.asList(attributeIds); return element.getAnyAttribute().stream() .filter(e -> attributes.contains(e.getEStructuralFeature().getName())) .map(e -> e.getValue().toString()) .findFirst(); }
protected Object getValue(FeatureMap featureMap, String name, boolean remove) { for (Iterator<FeatureMap.Entry> entries = featureMap.iterator(); entries .hasNext();) { FeatureMap.Entry entry = entries.next(); if (name.equals(entry.getEStructuralFeature().getName())) { if (remove) { entries.remove(); } return entry.getValue(); } } return null; }
protected Object getValue(FeatureMap featureMap, String name, boolean remove) { for (Iterator<FeatureMap.Entry> entries = featureMap.iterator(); entries .hasNext();) { FeatureMap.Entry entry = entries.next(); if (name.equals(entry.getEStructuralFeature().getName())) { if (remove) { entries.remove(); } return entry.getValue(); } } return null; }
public boolean retainAll(EStructuralFeature feature, Collection<?> collection) { boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature); FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature); List<Entry> entryCollection = new BasicEList<Entry>(collection.size()); Entry [] entries = (Entry[])data; for (int i = size; --i >= 0; ) { Entry entry = entries[i]; if (validator.isValid(entry.getEStructuralFeature())) { if (!collection.contains(isFeatureMap ? entry : entry.getValue())) { entryCollection.add(entry); } } } return removeAll(entryCollection); }
public Object setValue(int index, Object value) { Entry entry = (Entry)featureMap.get(getEStructuralFeature(), index, false); set(index, createEntry(entry.getEStructuralFeature(), value)); return entry.getValue(); }
private String getProcessPropertyValue(Process process, String propertyName) { Iterator<FeatureMap.Entry> iter = process.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next(); if (propertyName.equals(entry.getEStructuralFeature().getName())) { return entry.getValue().toString(); } } return null; }
Optional<java.lang.String> getStringValue(BaseElement element) { return element.getAnyAttribute().stream() .filter(e -> this.name().equals(e.getEStructuralFeature().getName())) .map(e -> e.getValue().toString()) .findFirst(); }
/** * Constructs a new {@code IterationResult} from an {@code entry}. * * @param direction the iteration direction used to prepare this result * @param entry the entry from which to retrieve the result and its associated feature */ public IterationResult(IterationDirection direction, FeatureMap.Entry entry) { this(direction, entry.getValue(), entry.getEStructuralFeature()); }
private static void handleUnknownFeatures(EObject owner, FeatureMap featureMap, LoadHandler handler) { Iterator<FeatureMap.Entry> iterator = featureMap.iterator(); while (iterator.hasNext()) { FeatureMap.Entry entry = iterator.next(); EStructuralFeature feature = entry.getEStructuralFeature(); if (handler.handleUnknownFeature(owner, feature, entry.getValue())) { iterator.remove(); } } }
@Override protected FeatureMap.Entry doCopyValue(Object value) { FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature innerFeature = entry.getEStructuralFeature(); Object innerValue = entry.getValue(); CDOType innerType = CDOModelUtil.getType(innerFeature.getEType()); Object innerCopy = innerType.copyValue(innerValue); return CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy); }
public Object setValue(int index, Object value) { Entry entry = (Entry)featureMap.get(getEStructuralFeature(), index, false); set(index, createEntry(entry.getEStructuralFeature(), value)); return entry.getValue(); }
protected static List<EObject> getContainedEObjects(List<FeatureMap.Entry> featureMapEntries) { List<EObject> result = new ArrayList<EObject>(); for (FeatureMap.Entry entry : featureMapEntries) { EStructuralFeature feature = entry.getEStructuralFeature(); if (feature instanceof EReference && ((EReference)feature).isContainment()) { result.add((EObject)entry.getValue()); } } return result; }
private String getProcessPropertyValue(Process process, String propertyName) { Iterator<FeatureMap.Entry> iter = process.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next(); if (propertyName.equals(entry.getEStructuralFeature().getName())) { return entry.getValue().toString(); } } return null; }
private static String getAttributeValue(FeatureMap featureMap, String name) { for (FeatureMap.Entry entry : featureMap) { EStructuralFeature feature = entry.getEStructuralFeature(); if (feature instanceof EAttribute && feature.getName().equals(name)) { return entry.getValue().toString(); } } return null; }
@Override protected Object validate(int index, Object object) { if (object instanceof FeatureMapEntry) { return object; } else { FeatureMap.Entry entry = (FeatureMap.Entry)object; return createFeatureMapEntry(entry.getEStructuralFeature(), entry.getValue()); } } };
protected Object getValue(FeatureMap featureMap, String name, boolean remove) { for (Iterator<FeatureMap.Entry> entries = featureMap.iterator(); entries .hasNext();) { FeatureMap.Entry entry = entries.next(); if (name.equals(entry.getEStructuralFeature().getName())) { if (remove) { entries.remove(); } return entry.getValue(); } } return null; }
protected static List<EObject> getContainedEObjects(List<FeatureMap.Entry> featureMapEntries) { List<EObject> result = new ArrayList<EObject>(); for (FeatureMap.Entry entry : featureMapEntries) { EStructuralFeature feature = entry.getEStructuralFeature(); if (feature instanceof EReference && ((EReference)feature).isContainment()) { result.add((EObject)entry.getValue()); } } return result; }
@Override public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { if (feature instanceof EStructuralFeature && FeatureMapUtil.isFeatureMap((EStructuralFeature)feature)) { FeatureMap.Entry entry = (FeatureMap.Entry)child; feature = entry.getEStructuralFeature(); child = entry.getValue(); } String childType = feature instanceof EAttribute ? getTypeText((EAttribute)feature) : getTypeText(child); return getResourceLocator().getString ("_UI_CreateChild_text2", new Object[] { childType, getFeatureText(feature), getTypeText(owner) }); }
@Override protected Object validate(int index, Object object) { if (object instanceof FeatureMapEntry) { return object; } else { FeatureMap.Entry entry = (FeatureMap.Entry)object; return createFeatureMapEntry(entry.getEStructuralFeature(), entry.getValue()); } } };
protected Collection<Object> getValues(FeatureMap featureMap, String name, boolean remove) { Collection<Object> values = new UniqueEList.FastCompare<Object>(); for (Iterator<FeatureMap.Entry> entries = featureMap.iterator(); entries .hasNext();) { FeatureMap.Entry entry = entries.next(); if (name.equals(entry.getEStructuralFeature().getName())) { if (remove) { entries.remove(); } values.add(entry.getValue()); } } return values; }