/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ColorPackage.DOCUMENT_ROOT__MIXED: if (coreType) return getMixed(); return ((FeatureMap.Internal)getMixed()).getWrapper(); case ColorPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: if (coreType) return getXMLNSPrefixMap(); else return getXMLNSPrefixMap().map(); case ColorPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: if (coreType) return getXSISchemaLocation(); else return getXSISchemaLocation().map(); case ColorPackage.DOCUMENT_ROOT__BACKGROUND_COLOR: return getBackgroundColor(); case ColorPackage.DOCUMENT_ROOT__BORDER_COLOR: return getBorderColor(); case ColorPackage.DOCUMENT_ROOT__COLOR: return getColor(); } return super.eGet(featureID, resolve, coreType); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ColorPackage.DOCUMENT_ROOT__MIXED: return mixed != null && !mixed.isEmpty(); case ColorPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty(); case ColorPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: return xSISchemaLocation != null && !xSISchemaLocation.isEmpty(); case ColorPackage.DOCUMENT_ROOT__BACKGROUND_COLOR: return BACKGROUND_COLOR_EDEFAULT == null ? backgroundColor != null : !BACKGROUND_COLOR_EDEFAULT.equals(backgroundColor); case ColorPackage.DOCUMENT_ROOT__BORDER_COLOR: return BORDER_COLOR_EDEFAULT == null ? borderColor != null : !BORDER_COLOR_EDEFAULT.equals(borderColor); case ColorPackage.DOCUMENT_ROOT__COLOR: return COLOR_EDEFAULT == null ? color != null : !COLOR_EDEFAULT.equals(color); } return super.eIsSet(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ColorPackage.DOCUMENT_ROOT__MIXED: getMixed().clear(); return; case ColorPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: getXMLNSPrefixMap().clear(); return; case ColorPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: getXSISchemaLocation().clear(); return; case ColorPackage.DOCUMENT_ROOT__BACKGROUND_COLOR: setBackgroundColor(BACKGROUND_COLOR_EDEFAULT); return; case ColorPackage.DOCUMENT_ROOT__BORDER_COLOR: setBorderColor(BORDER_COLOR_EDEFAULT); return; case ColorPackage.DOCUMENT_ROOT__COLOR: setColor(COLOR_EDEFAULT); return; } super.eUnset(featureID); }
/** * Sorts all functionblock properties according to their functionblock model */ public static EMap<FunctionblockModel, EList<FunctionblockProperty>> sortByPropertyType(final EList<FunctionblockProperty> properties) { EMap<FunctionblockModel, EList<FunctionblockProperty>> map = new BasicEMap<FunctionblockModel, EList<FunctionblockProperty>>(); for (final FunctionblockProperty property : properties) { FunctionblockModel _type = property.getType(); boolean _containsKey = map.containsKey(_type); if (_containsKey) { FunctionblockModel _type_1 = property.getType(); EList<FunctionblockProperty> eList = map.get(_type_1); eList.add(property); FunctionblockModel _type_2 = property.getType(); map.put(_type_2, eList); } else { EList<FunctionblockProperty> eList_1 = new BasicEList<FunctionblockProperty>(); eList_1.add(property); FunctionblockModel _type_3 = property.getType(); map.put(_type_3, eList_1); } } return map; } }
protected void addAnnotation(ENamedElement eNamedElement, int depth, String source, String [] details, URI [] references) { EAnnotation eAnnotation = ecoreFactory.createEAnnotation(); eAnnotation.setSource(source); EMap<String, String> theDetails = eAnnotation.getDetails(); for (int i = 1; i < details.length; i += 2) { theDetails.put(details[i - 1], details[i]); } EList<EAnnotation> annotations = eNamedElement.getEAnnotations(); for (int i = 0; i < depth; ++i) { @SuppressWarnings("unchecked") EList<EAnnotation> childAnnotations = (EList<EAnnotation>)(EList<?>)annotations.get(annotations.size() - 1).getContents(); annotations = childAnnotations; } annotations.add(eAnnotation); if (references != null) { InternalEList<EObject> eAnnotationReferences = (InternalEList<EObject>)eAnnotation.getReferences(); for (URI reference : references) { InternalEObject internalEObject = (InternalEObject)ecoreFactory.createEObject(); internalEObject.eSetProxyURI(reference); eAnnotationReferences.addUnique(internalEObject); } } }
public static void setConstraints(EModelElement eModelElement, List<String> constraints) { EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI); if (constraints == null || constraints.isEmpty()) { if (eAnnotation != null) { eAnnotation.getDetails().removeKey("constraints"); } } else { if (eAnnotation == null) { eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); eAnnotation.setSource(EcorePackage.eNS_URI); eModelElement.getEAnnotations().add(eAnnotation); } StringBuffer value = new StringBuffer(); for (Iterator<String> i = constraints.iterator(); i.hasNext();) { value.append(i.next()); if (i.hasNext()) { value.append(' '); } } eAnnotation.getDetails().put("constraints", value.toString()); } }
EDataType dataType = (EDataType) feature.getEType(); if (feature.isMany()) { if (nextToken == JsonToken.START_ARRAY) { EList values = new BasicEList(); while (jp.nextToken() != JsonToken.END_ARRAY) { values.add(parseValueForDataType(jp, dataType)); if (feature.isMany() && nextToken == JsonToken.START_ARRAY) { EList values = new BasicEList(); while (jp.nextToken() != JsonToken.END_ARRAY) { values.add(from(jp, eRef.getEReferenceType())); jsObj.getUnmatched().put(fieldName, parseValueForUnmapped(nextToken, jp));
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RfcPackage.DESTINATION_DATA_STORE__ENTRIES: return entries != null && !entries.isEmpty(); case RfcPackage.DESTINATION_DATA_STORE__DESTINATION_DATA: return destinationData != null && !destinationData.isEmpty(); } return super.eIsSet(featureID); }
/** * Marks the specified operations as being collection iterators (as distinct * from ordinary operations). * * @param operations operations to designate as iterators */ public static void stereotypeAsIterator(Collection<EOperation> operations) { for (EOperation oper : operations) { EAnnotation ann = org.eclipse.emf.ecore.EcoreFactory.eINSTANCE.createEAnnotation(); ann.setSource(Environment.OCL_NAMESPACE_URI); ann.getDetails().put("keywords", "iterator"); //$NON-NLS-1$ //$NON-NLS-2$ oper.getEAnnotations().add(ann); } }
public static void setAnnotation(GenBase genBase, String sourceURI, String key, String value) { GenAnnotation genAnnotation = genBase.getGenAnnotation(sourceURI); if (genAnnotation == null) { genAnnotation = GenModelFactory.eINSTANCE.createGenAnnotation(); genAnnotation.setSource(sourceURI); genBase.getGenAnnotations().add(genAnnotation); } genAnnotation.getDetails().put(key, value); } }
public void setDelegates(EPackage ePackage, List<String> delegateURIs) { final String name = getName(); EAnnotation eAnnotation = ePackage.getEAnnotation(EcorePackage.eNS_URI); if (delegateURIs == null || delegateURIs.isEmpty()) { if (eAnnotation != null) { eAnnotation.getDetails().remove(name); } } else { if (eAnnotation == null) { eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); eAnnotation.setSource(EcorePackage.eNS_URI); ePackage.getEAnnotations().add(eAnnotation); } StringBuilder value = new StringBuilder(); for (Iterator<String> i = delegateURIs.iterator(); i.hasNext();) { value.append(i.next()); if (i.hasNext()) { value.append(' '); } } eAnnotation.getDetails().put(name, value.toString()); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RfcPackage.SERVER_DATA_STORE__ENTRIES: getEntries().clear(); return; case RfcPackage.SERVER_DATA_STORE__SERVER_DATA: getServerData().clear(); return; } super.eUnset(featureID); }
for (EStructuralFeature feature : eClass.getEAllStructuralFeatures()) { String jsonKey = JsonMetadata.getJsonFieldName(feature); if (feature.isUnsettable() && !eObj.eIsSet(feature)) { continue; for (Map.Entry<String, Object> entry : unmatched.entrySet()) { jg.writeObjectField(entry.getKey(), entry.getValue()); EDataType dataType = (EDataType) feature.getEType(); if (feature.isMany()) { List<Object> childObjs = (List<Object>) eObj.eGet(feature); jg.writeFieldName(jsonKey);
public boolean isApplicable(EStructuralFeature eStructuralFeature) { Method method = PropertySwitch.ENTRY_VALIDATORS.get(eClass); EMap<String, String> details = EcoreFactory.eINSTANCE.createEAnnotation().getDetails(); details.put(eStructuralFeature.getName(), null); try { return (Boolean)method.invoke(extendedMetaData, eNamedElement, details.get(0), null, null); } catch (Exception exception) { throw new RuntimeException(exception); } }
@Override protected void handleFeature(String prefix, String name) { super.handleFeature(prefix, name); // Interpret the body of a nested ownedComment as a comment-type and assign it as the EAnnotation.source of the parent. // if (EMOFExtendedMetaData.EMOF_OWNED_COMMENT.equals(name) && objects.peekEObject() instanceof EAnnotation) { EAnnotation annotation = (EAnnotation)objects.peekEObject(); EObject container = annotation.eContainer(); if (container instanceof EAnnotation) { EAnnotation parentAnnotation = (EAnnotation)container; parentAnnotation.setSource(annotation.getDetails().get(EMOFExtendedMetaData.EMOF_COMMENT_BODY)); parentAnnotation.getEAnnotations().remove(annotation); } } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object get(String key) { EStructuralFeature feature = JsonMetadata.INSTANCE.getJsonFeature(key, eClass()); if (feature != null) { return eGet(feature); } return getUnmatched().get(key); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public JsObject with(String key, Object value) { EStructuralFeature feature = JsonMetadata.INSTANCE.getJsonFeature(key, eClass()); if (feature != null) { eSet(feature, value); } else { getUnmatched().put(key, value); } return this; }
protected static String getValue(ENamedElement element, String annotation, String property) { EAnnotation ann = element.getEAnnotation(annotation); if (ann != null && ann.getDetails().containsKey(property)) { return ann.getDetails().get(property); } return null; }
/** * Tests whether the given structural feature has been annotated to prevent generation of accessor methods in its * interface. * @param eStructuralFeature the structural feature * @param accessor the type of accessor method, one of {@link #GET}, {@link #SET}, {@link #IS_SET}, or {@link #UNSET} * @return whether the specified accessor's visibility is suppressed * @since 2.1 */ public static boolean isSuppressedVisibility(EStructuralFeature eStructuralFeature, int accessor) { if (accessor < GET || accessor > UNSET) throw new IllegalArgumentException("Invalid accessor identifier: " + accessor); EAnnotation eAnnotation = eStructuralFeature.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI); return eAnnotation == null ? false : TRUE.equalsIgnoreCase(eAnnotation.getDetails().get(ACCESSOR_KEYS[accessor])); }