EObject object = map.get(key); System.out.println("#" + key + " " + object.eClass().getName()); for (EAttribute attribute : object.eClass().getEAllAttributes()) { System.out.println("\t" + attribute.getName() + "(" + attribute.getEType().getName() + "): " + object.eGet(attribute));
@SuppressWarnings({ "rawtypes", "unchecked" }) private void setDoubleAsStringValues(IdEObject idEObject) { for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) { if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEDouble()) { EStructuralFeature asStringFeature = idEObject.eClass().getEStructuralFeature(eAttribute.getName() + "AsString"); if (asStringFeature != null) { if (eAttribute.isMany()) { List list = (List) idEObject.eGet(eAttribute); List listAsString = (List) idEObject.eGet(asStringFeature); for (int i = 0; i < list.size(); i++) { listAsString.set(i, "" + list.get(i)); } } else { idEObject.eSet(asStringFeature, "" + idEObject.eGet(eAttribute)); } } } } }
printIndention(indention); System.out.println(idEObject.eClass().getName() + " (" + idEObject.getOid() + ")"); for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) { Object val = idEObject.eGet(eAttribute); if (val != null) {
for (EAttribute eAttribute : eClass.getEAllAttributes()) { if (eAttribute.getEType() instanceof EEnum) { for (EAttribute eAttribute : eClass.getEAllAttributes()) { if (eAttribute.getEType() instanceof EEnum) {
if (originalObject != null) { boolean objectChanged = false; for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) { Object value = idEObject.eGet(eAttribute); Object originalValue = originalObject.eGet(eAttribute);
private IdEObject convertWrapped(Revision revision, IfcModelInterface ifcModel, HashMapWrappedVirtualObject hashMapWrappedVirtualObject) throws IfcModelInterfaceException { IdEObject embeddedObject = ifcModel.create(hashMapWrappedVirtualObject.eClass()); ((IdEObjectImpl)embeddedObject).setOid(-1); ((IdEObjectImpl)embeddedObject).setPid(revision.getProject().getId()); for (EAttribute eAttribute : hashMapWrappedVirtualObject.eClass().getEAllAttributes()) { embeddedObject.eSet(eAttribute, hashMapWrappedVirtualObject.eGet(eAttribute)); } return embeddedObject; }
private void copyAttributesGuidObjectsAndAddNewObjects() throws IfcModelInterfaceException, ObjectAlreadyExistsException { for (IdEObject idEObject : newModel.getValues()) { if (idEObject instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot) idEObject; String guid = ifcRoot.getGlobalId(); if (resultModel.containsGuid(guid)) { // LOGGER.info("Updating attributes for object " + idEObject.eClass().getName() + " " + guid); IfcRoot oldObject = (IfcRoot) resultModel.getByGuid(guid); for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) { Object newValue = idEObject.eGet(eAttribute); oldObject.eSet(eAttribute, newValue); } } else { // LOGGER.info("Adding new GUID object " + idEObject.eClass().getName() + " " + guid); IdEObject newObject = (IdEObject) idEObject.eClass().getEPackage().getEFactoryInstance().create(idEObject.eClass()); ((IdEObjectImpl)newObject).setOid(idEObject.getOid()); ((IfcRoot) newObject).setGlobalId(newGuid(guid)); for (EAttribute eAttribute : newObject.eClass().getEAllAttributes()) { newObject.eSet(eAttribute, idEObject.eGet(eAttribute)); } resultModel.add(newObject.getOid(), newObject); } } } }
protected Collection<? extends EAttribute> getAttributesToCopy() { return owner.eClass().getEAllAttributes(); }
target.add(newObject.getOid(), newObject); for (EAttribute eAttribute : newObject.eClass().getEAllAttributes()) { newObject.eSet(eAttribute, idEObject.eGet(eAttribute));
@Override protected Collection<? extends EAttribute> getAttributesToCopy() { Collection<EAttribute> result = new ArrayList<EAttribute>(this.owner.eClass().getEAllAttributes()); result.remove(xsdPackage.getXSDConcreteComponent_Element()); return result; } };
public boolean validate_EveryDataValueConforms(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = true; for (EAttribute eAttribute : eObject.eClass().getEAllAttributes()) { result &= validate_DataValueConforms(eObject, eAttribute, diagnostics, context); if (!result && diagnostics == null) { return false; } } return result; }
public boolean validate_EveryDataValueConforms(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = true; for (EAttribute eAttribute : eObject.eClass().getEAllAttributes()) { result &= validate_DataValueConforms(eObject, eAttribute, diagnostics, context); if (!result && diagnostics == null) { return false; } } return result; }
@Override protected Collection<? extends EAttribute> getAttributesToCopy() { Collection<EAttribute> result = new ArrayList<EAttribute>(this.owner.eClass().getEAllAttributes()); result.remove(xsdPackage.getXSDConcreteComponent_Element()); result.remove(xsdPackage.getXSDSchema_Document()); return result; }
@Override public Collection<?> getChoiceOfValues(Object object) { EReference eReference = (EReference)object; List<Object> result = new ArrayList<Object>(); if (eReference.getEType() instanceof EClass) { result.addAll(eReference.getEReferenceType().getEAllAttributes()); } return result; } });
protected EStructuralFeature getContentFeature(EObject object) { if (xmlMap != null) { List<EAttribute> eAttributes = object.eClass().getEAllAttributes(); if (eAttributes.size() >= 1) { EAttribute eAttribute = eAttributes.get(0); XMLInfo info = xmlMap.getInfo(eAttribute); if (info != null && info.getXMLRepresentation() == XMLInfo.CONTENT) { return eAttribute; } } } return null; } } // SAXXMLHandler
@Override public void mapAllEObjectPropertiesToGraph(final SphereTransactionContext ctx, final ChronoEObject eObject) { checkNotNull(ctx, "Precondition violation - argument 'ctx' must not be NULL!"); checkNotNull(eObject, "Precondition violation - argument 'eObject' must not be NULL!"); checkNotNull(eObject.eClass(), "Precondition violation - argument 'eObject' has no 'eClass' assigned!"); // iterate over the attributes and assign them to the vertex one by one for (EAttribute attribute : eObject.eClass().getEAllAttributes()) { this.mapEAttributeToGraph(ctx, eObject, attribute); } }
protected EAttribute getNameEAttribute(final EObject target) { final Function1<EAttribute, Boolean> _function = (EAttribute it) -> { return Boolean.valueOf((Objects.equal(it.getName(), "name") && Objects.equal(it.getEType(), EcorePackage.Literals.ESTRING))); }; return IterableExtensions.<EAttribute>head(IterableExtensions.<EAttribute>filter(target.eClass().getEAllAttributes(), _function)); } }
private TransformationModelElement createTransformationElement(EObject eobject) { TransformationModelElement element = new TransformationModelElement(); for (EAttribute attribute : eobject.eClass().getEAllAttributes()) { Object eGet = eobject.eGet(attribute); if (eGet != null && !attribute.getName().equals(TransformationModelElement.TYPE_ATTR)) { element.addAttribute(attribute.getName(), eobject.eGet(attribute).toString()); } } element.addAttribute(TransformationModelElement.TYPE_ATTR, eobject.eClass().getName()); elementMap.put(element, eobject); return element; }
idEObjectImpl.setPid(revision.getProject().getId()); idEObjectImpl.setOid(next.getOid()); for (EAttribute eAttribute : newObject.eClass().getEAllAttributes()) { Object value = next.eGet(eAttribute); if (eAttribute.isMany()) {
protected EStructuralFeature getLabelFeature(EClass eClass) { EAttribute result = null; for (EAttribute eAttribute : eClass.getEAllAttributes()) { if (!eAttribute.isMany() && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) { if ("name".equalsIgnoreCase(eAttribute.getName())) { result = eAttribute; break; } else if (result == null) { result = eAttribute; } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class && result.getEAttributeType().getInstanceClass() != String.class) { result = eAttribute; } } } return result; } }