congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
EStructuralFeature.getEType
Code IndexAdd Tabnine to your IDE (free)

How to use
getEType
method
in
org.eclipse.emf.ecore.EStructuralFeature

Best Java code snippets using org.eclipse.emf.ecore.EStructuralFeature.getEType (Showing top 20 results out of 531)

origin: geotools/geotools

static Collection createEmptyCollection(EStructuralFeature feature) {
  Class clazz = feature.getEType().getInstanceClass();
  if (EList.class.isAssignableFrom(clazz)) {
    return new BasicEList();
  }
  if (List.class.isAssignableFrom(clazz)) {
    return new ArrayList();
  }
  if (Set.class.isAssignableFrom(clazz)) {
    return new HashSet();
  }
  throw new IllegalArgumentException("Unable to create collection for " + clazz);
}
origin: geotools/geotools

/**
 * Method which looks up structural features of an eobject by type.
 *
 * @param eobject The eobject.
 * @param propertyType The type of the properties.
 * @return The list of structure features, or an empty list if none are found.
 */
public static List /*<EStructuralFeature>*/ features(EObject eobject, Class propertyType) {
  List match = new ArrayList();
  List features = eobject.eClass().getEAllStructuralFeatures();
  for (Iterator itr = features.iterator(); itr.hasNext(); ) {
    EStructuralFeature feature = (EStructuralFeature) itr.next();
    if (feature.getEType().getInstanceClass().isAssignableFrom(propertyType)) {
      match.add(feature);
    }
  }
  return match;
}
origin: opensourceBIM/BIMserver

private void sortComplexList(final ObjectIDM objectIDM, final EClass originalQueryClass, EList<IdEObject> list, EStructuralFeature eStructuralFeature) {
  final EClass type = (EClass) eStructuralFeature.getEType();
  ECollections.sort(list, new Comparator<IdEObject>() {
    @Override
    public int compare(IdEObject o1, IdEObject o2) {
      int i = 1;
      for (EStructuralFeature eStructuralFeature : type.getEAllStructuralFeatures()) {
        if (objectIDM.shouldFollowReference(originalQueryClass, type, eStructuralFeature)) {
          Object val1 = o1.eGet(eStructuralFeature);
          Object val2 = o2.eGet(eStructuralFeature);
          if (val1 != null && val2 != null) {
            if (eStructuralFeature.getEType() instanceof EClass) {
              if (eStructuralFeature.getEType().getEAnnotation("wrapped") != null) {
                int compare = comparePrimitives((IdEObject) val1, (IdEObject) val2);
                if (compare != 0) {
                  return compare * i;
                }
              }
            }
          }
          i++;
        }
      }
      return 0;
    }
  });
}
origin: geotools/geotools

/**
 * Determines if a feature of an eobject is a collection.
 *
 * @return <code>true</code> if the feature is a collection, otherwise <code>false</code>
 */
public static boolean isCollection(EObject eobject, EStructuralFeature feature) {
  Object o = eobject.eGet(feature);
  if (o != null) {
    return o instanceof Collection;
  }
  if (Collection.class.isAssignableFrom(feature.getEType().getInstanceClass())) {
    return true;
  }
  return false;
}
origin: opensourceBIM/BIMserver

private void writeEnum(EStructuralFeature feature, Object value) {
  if (value == null) {
    ensureCapacity(buffer.position(), 4);
    buffer.putInt(-1);
  } else {
    EEnum eEnum = (EEnum) feature.getEType();
    EEnumLiteral eEnumLiteral = eEnum.getEEnumLiteralByLiteral(((Enum<?>) value).toString());
    ensureCapacity(buffer.position(), 4);
    if (eEnumLiteral != null) {
      buffer.putInt(eEnumLiteral.getValue());
    } else {
      LOGGER.error(((Enum<?>) value).toString() + " not found");
      buffer.putInt(-1);
    }
  }
}
origin: opensourceBIM/BIMserver

public static String makeGetter(EStructuralFeature eStructuralFeature) {
  StringBuilder sb = new StringBuilder();
  if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEBoolean()) {
    sb.append("is");
  } else {
    sb.append("get");
  }
  sb.append(firstLetterUpperCase(eStructuralFeature.getName()));
  if (eStructuralFeature instanceof EReference && !eStructuralFeature.isMany() && eStructuralFeature.getEAnnotation("embedsreference") == null) {
    sb.append("Id");
  }
  return sb.toString();
}
 
origin: opensourceBIM/BIMserver

private int comparePrimitives(IdEObject o1, IdEObject o2) {
  EClass eClass = o1.eClass();
  EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature("wrappedValue");
  Object val1 = o1.eGet(eStructuralFeature);
  Object val2 = o2.eGet(eStructuralFeature);
  if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEString()) {
    return ((String) val1).compareTo((String) val2);
  } else if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEInt()) {
    return ((Integer) val1).compareTo((Integer) val2);
  } else {
    throw new RuntimeException("ni");
  }
}
origin: opensourceBIM/BIMserver

  public void setAttribute(EStructuralFeature feature, Object value) throws BimserverDatabaseException {
    if (feature.isMany()) {
      throw new UnsupportedOperationException("Feature isMany not supported by setAttribute");
    } else {
      if (feature.getEType() instanceof EEnum) {
        writeEnum(feature, value);
      } else if (feature.getEType() instanceof EClass) {
        if (value == null) {
          ensureCapacity(buffer.position(), 2);
          buffer.order(ByteOrder.LITTLE_ENDIAN);
          buffer.putShort((short) -1);
          buffer.order(ByteOrder.BIG_ENDIAN);
        } else if (value instanceof WrappedVirtualObject) {
          ByteBuffer otherBuffer = ((WrappedVirtualObject) value).write();
          ensureCapacity(buffer.position(), otherBuffer.position());
          buffer.put(otherBuffer.array(), 0, otherBuffer.position());
//                    writeWrappedValue(getPid(), getRid(), (WrappedVirtualObject) value, getPackageMetaData());
        } else {
          throw new UnsupportedOperationException("??");
        }
      } else if (feature.getEType() instanceof EDataType) {
        writePrimitiveValue(feature, value);
      }
    }
    incrementFeatureCounter(feature);
  }
 
origin: opensourceBIM/BIMserver

private void addToList(EStructuralFeature eStructuralFeature, int index, AbstractEList list, EObject referencedObject) throws DeserializeException {
  EClass referenceEClass = referencedObject.eClass();
  if (((EClass) eStructuralFeature.getEType()).isSuperTypeOf(referenceEClass)) {
    while (list.size() <= index) {
      list.addUnique(referencedObject);
    }
  } else {
    throw new DeserializeException(-1, referenceEClass.getName() + " cannot be stored in " + eStructuralFeature.getName());
  }
}
origin: opensourceBIM/BIMserver

private HashMapWrappedVirtualObject readWrappedValue(EStructuralFeature feature, ByteBuffer buffer, EClass eClass) throws BimserverDatabaseException {
  EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature("wrappedValue");
  Object primitiveValue = readPrimitiveValue(eStructuralFeature.getEType(), buffer);
  HashMapWrappedVirtualObject eObject = new HashMapWrappedVirtualObject(eClass);
  eObject.setAttribute(eStructuralFeature, primitiveValue);
  if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) {
    EStructuralFeature strFeature = eClass.getEStructuralFeature("wrappedValueAsString");
    Object stringVal = readPrimitiveValue(EcorePackage.eINSTANCE.getEString(), buffer);
    eObject.setAttribute(strFeature, stringVal);
  }
  return eObject;
}
origin: opensourceBIM/BIMserver

public void eUnset(EStructuralFeature feature) throws BimserverDatabaseException {
  if (useUnsetBit(feature)) {
    int pos = featureCounter / 8;
    byte b = buffer.get(pos);
    b |= (1 << (featureCounter % 8));
    buffer.put(pos, b);
  } else {
    if (feature instanceof EReference) {
      if (feature.isMany()) {
        ensureCapacity(buffer.position(), 4);
        buffer.putInt(0);
      } else {
        ensureCapacity(buffer.position(), 2);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putShort((short)-1);
        buffer.order(ByteOrder.BIG_ENDIAN);
      }
    } else if (feature.getEType() instanceof EEnum) {
      writeEnum(feature, null);
    } else {
      writePrimitiveValue(feature, null);
    }
  }
  incrementFeatureCounter(feature);
}
origin: opensourceBIM/BIMserver

  @Override
  public void migrate(Schema schema, DatabaseSession databaseSession) {
    schema.loadEcore("ifc2x3_tc1.ecore", getClass().getResourceAsStream("IFC2X3_TC1.ecore"));
    for (EClassifier eClassifier : schema.getEPackage("ifc2x3tc1").getEClassifiers()) {
      if (eClassifier instanceof EClass) {
        EClass eClass = (EClass)eClassifier;
        for (EStructuralFeature eStructuralFeature : eClass.getEStructuralFeatures()) {
          if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEString()) {
            // A hack because unfortunately not every "Name" field inherits from IfcRoot.Name, same could be true for GlobalId
            if (eStructuralFeature.getName().equals("Name") || eStructuralFeature.getName().equals("GlobalId")) {
//                            System.out.println(eClass.getName() + "." + eStructuralFeature.getName());
              schema.addIndex(eStructuralFeature);
            }
          }
        }
      }
    }
  }
 
origin: opensourceBIM/BIMserver

  @Override
  public int compare(IdEObject o1, IdEObject o2) {
    int i = 1;
    for (EStructuralFeature eStructuralFeature : type.getEAllStructuralFeatures()) {
      if (objectIDM.shouldFollowReference(originalQueryClass, type, eStructuralFeature)) {
        Object val1 = o1.eGet(eStructuralFeature);
        Object val2 = o2.eGet(eStructuralFeature);
        if (val1 != null && val2 != null) {
          if (eStructuralFeature.getEType() instanceof EClass) {
            if (eStructuralFeature.getEType().getEAnnotation("wrapped") != null) {
              int compare = comparePrimitives((IdEObject) val1, (IdEObject) val2);
              if (compare != 0) {
                return compare * i;
              }
            }
          }
        }
        i++;
      }
    }
    return 0;
  }
});
origin: opensourceBIM/BIMserver

private void compareEClass(EClass eClass1, EClass eClass2) throws SchemaCompareException {
  if (eClass1.getEAllStructuralFeatures().size() != eClass2.getEAllStructuralFeatures().size()) {
    throw new SchemaCompareException("Not the same amount of features in " + eClass1.getName());
  }
  Iterator<EStructuralFeature> iterator1 = eClass1.getEAllStructuralFeatures().iterator();
  Iterator<EStructuralFeature> iterator2 = eClass2.getEAllStructuralFeatures().iterator();
  while (iterator1.hasNext()) {
    EStructuralFeature structuralFeature1 = iterator1.next();
    EStructuralFeature structuralFeature2 = iterator2.next();
    if (!structuralFeature1.getName().equals(structuralFeature2.getName())) {
      throw new SchemaCompareException("Features not the same name");
    }
    if (!structuralFeature1.getEType().getName().equals(structuralFeature2.getEType().getName())) {
      throw new SchemaCompareException("Features not of the same type");
    }
  }
}
origin: opensourceBIM/BIMserver

private IdEObject readWrappedValue(EStructuralFeature feature, ByteBuffer buffer, EClass eClass, QueryInterface query) {
  EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature("wrappedValue");
  Object primitiveValue = readPrimitiveValue(eStructuralFeature.getEType(), buffer, query);
  IdEObject eObject = createInternal(eClass, query);
  ((IdEObjectImpl) eObject).setLoaded(); // We don't want to go lazy load
                      // this
  eObject.eSet(eStructuralFeature, primitiveValue);
  if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) {
    EStructuralFeature strFeature = eClass.getEStructuralFeature("wrappedValueAsString");
    Object stringVal = readPrimitiveValue(EcorePackage.eINSTANCE.getEString(), buffer, query);
    eObject.eSet(strFeature, stringVal);
  }
  return eObject;
}
origin: opensourceBIM/BIMserver

private void writeWrappedValue(int pid, int rid, WrappedVirtualObject wrappedValue, ByteBuffer buffer, PackageMetaData packageMetaData) throws BimserverDatabaseException {
  Short cid = getDatabaseInterface().getCidOfEClass(wrappedValue.eClass());
  buffer.order(ByteOrder.LITTLE_ENDIAN);
  buffer.putShort((short) -cid);
  buffer.order(ByteOrder.BIG_ENDIAN);
  for (EStructuralFeature eStructuralFeature : wrappedValue.eClass().getEAllStructuralFeatures()) {
    Object val = wrappedValue.eGet(eStructuralFeature);
    if (eStructuralFeature.isMany()) {
      List list = (List)val;
      buffer.putInt(list.size());
      for (Object o : list) {
        if (o instanceof HashMapWrappedVirtualObject) {
          writeWrappedValue(pid, rid, (VirtualObject) o, buffer, packageMetaData);
        }
      }
    } else {
      if (eStructuralFeature.getEType() instanceof EDataType) {
        writePrimitiveValue(eStructuralFeature, val, buffer);
      } else {
        writeWrappedValue(pid, rid, (HashMapWrappedVirtualObject) val, buffer, packageMetaData);
      }
    }
  }
}
 
origin: opensourceBIM/BIMserver

private void writeEmbeddedValue(int pid, int rid, Object value, ByteBuffer buffer, PackageMetaData packageMetaData) throws BimserverDatabaseException {
  IdEObject wrappedValue = (IdEObject) value;
  Short cid = database.getCidOfEClass(wrappedValue.eClass());
  buffer.order(ByteOrder.LITTLE_ENDIAN);
  buffer.putShort((short) -cid);
  buffer.order(ByteOrder.BIG_ENDIAN);
  
  for (EStructuralFeature eStructuralFeature : wrappedValue.eClass().getEAllStructuralFeatures()) {
    if (eStructuralFeature.isMany()) {
      writeList(wrappedValue, buffer, packageMetaData, eStructuralFeature);
    } else {
      Object val = wrappedValue.eGet(eStructuralFeature);
      if (eStructuralFeature.getEType() instanceof EClass) {
        writeEmbeddedValue(pid, rid, val, buffer, packageMetaData);
      } else {
        writePrimitiveValue(eStructuralFeature, val, buffer);
      }
    }
  }
}

origin: opensourceBIM/BIMserver

private void writeWrappedValue(int pid, int rid, Object value, ByteBuffer buffer, PackageMetaData packageMetaData) throws BimserverDatabaseException {
  IdEObject wrappedValue = (IdEObject) value;
  EStructuralFeature eStructuralFeature = wrappedValue.eClass().getEStructuralFeature("wrappedValue");
  Short cid = database.getCidOfEClass(wrappedValue.eClass());
  buffer.order(ByteOrder.LITTLE_ENDIAN);
  buffer.putShort((short) -cid);
  buffer.order(ByteOrder.BIG_ENDIAN);
  writePrimitiveValue(eStructuralFeature, wrappedValue.eGet(eStructuralFeature), buffer);
  if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) {
    EStructuralFeature fe = wrappedValue.eClass().getEStructuralFeature("wrappedValueAsString");
    writePrimitiveValue(fe, wrappedValue.eGet(fe), buffer);
  }
  if (wrappedValue.eClass().getName().equals("IfcGloballyUniqueId")) {
    EClass eClass = packageMetaData.getEClass("IfcGloballyUniqueId");
    if (wrappedValue.getOid() == -1) {
      ((IdEObjectImpl) wrappedValue).setOid(newOid(eClass));
    }
    ByteBuffer valueBuffer = convertObjectToByteArray(wrappedValue, ByteBuffer.allocate(getExactSize(wrappedValue, packageMetaData, true)), packageMetaData);
    ByteBuffer keyBuffer = createKeyBuffer(pid, wrappedValue.getOid(), rid);
    try {
      database.getKeyValueStore().storeNoOverwrite(eClass.getEPackage().getName() + "_" + eClass.getName(),
          keyBuffer.array(), valueBuffer.array(), this);
      database.incrementCommittedWrites(1);
    } catch (BimserverLockConflictException e) {
      LOGGER.error("", e);
    }
  }
}

origin: opensourceBIM/BIMserver

protected EStructuralFeature.Internal.SettingDelegate eSettingDelegate(EStructuralFeature eFeature) {
  SettingDelegate eSettingDelegate = super.eSettingDelegate(eFeature);
  if (useInverses) {
    return eSettingDelegate;
  }
  if (eFeature instanceof EReference && ((EReference)eFeature).getEOpposite() != null) {
    // TODO cache/pre-generate the objects created in this block
    if (eFeature.isMany()) {
      if (eFeature.isUnsettable()) {
        return new InternalSettingDelegateMany(InternalSettingDelegateMany.EOBJECT_UNSETTABLE, eFeature);
      } else {
        return new InternalSettingDelegateMany(InternalSettingDelegateMany.EOBJECT, eFeature);
      }
    } else {
      if (eFeature.isUnsettable()) {
        return new InternalSettingDelegateSingleEObjectUnsettable((EClass) eFeature.getEType(), eFeature);
      } else {
        return new InternalSettingDelegateSingleEObject((EClass) eFeature.getEType(), eFeature);
      }
    }
  } else {
    return eSettingDelegate;
  }
}
origin: opensourceBIM/BIMserver

@SuppressWarnings("unchecked")
public void sortAllAggregates(ObjectIDM objectIDM, IdEObject ifcRoot) {
  for (EStructuralFeature eStructuralFeature : ifcRoot.eClass().getEAllStructuralFeatures()) {
    if (objectIDM.shouldFollowReference(ifcRoot.eClass(), ifcRoot.eClass(), eStructuralFeature)) {
      if (eStructuralFeature.getUpperBound() == -1 || eStructuralFeature.getUpperBound() > 1) {
        if (eStructuralFeature.getEType() instanceof EClass) {
          if (eStructuralFeature.getEType().getEAnnotation("wrapped") != null) {
            EList<IdEObject> list = (EList<IdEObject>) ifcRoot.eGet(eStructuralFeature);
            sortPrimitiveList(list);
          } else {
            EList<IdEObject> list = (EList<IdEObject>) ifcRoot.eGet(eStructuralFeature);
            sortComplexList(objectIDM, ifcRoot.eClass(), list, eStructuralFeature);
          }
        }
      }
    }
  }
}
org.eclipse.emf.ecoreEStructuralFeaturegetEType

Popular methods of EStructuralFeature

  • getName
  • isMany
  • getEContainingClass
    Returns the value of the 'EContaining Class' container reference. It is bidirectional and its opposi
  • isUnsettable
    Returns the value of the 'Unsettable' attribute. An unsettable feature explicitly models the state o
  • isChangeable
    Returns the value of the 'Changeable' attribute. The default value is "true".
  • isDerived
    Returns the value of the 'Derived' attribute. A derived feature typically computes its value from th
  • isTransient
    Returns the value of the 'Transient' attribute.
  • getDefaultValue
    Returns the value of the 'Default Value' attribute. It represents the default value that feature mus
  • getUpperBound
  • getDefaultValueLiteral
    Returns the value of the 'Default Value Literal' attribute. It represents the serialized form of the
  • getEGenericType
  • isUnique
  • getEGenericType,
  • isUnique,
  • getFeatureID,
  • getEAnnotation,
  • getLowerBound,
  • isOrdered,
  • setChangeable,
  • eIsProxy,
  • setUpperBound

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JCheckBox (javax.swing)
  • JTable (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now