org.eclipse.vorto.core.api.model.datatype.Entity.getSuperType()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.eclipse.vorto.core.api.model.datatype.Entity.getSuperType()方法的一些代码示例,展示了Entity.getSuperType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getSuperType()方法的具体详情如下:
包路径:org.eclipse.vorto.core.api.model.datatype.Entity
类名称:Entity
方法名:getSuperType

Entity.getSuperType介绍

[英]Returns the value of the 'Super Type' reference.

If the meaning of the 'Super Type' reference isn't clear, there really should be more of a description here...
[中]返回“Super-Type”引用的值。
如果“Super-Type”引用的含义不清楚,那么这里应该有更多的描述。。。

代码示例

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.editor.datatype

@Override
 public Collection<Model> apply(final Model input) {
  final ArrayList<Model> children = Lists.<Model>newArrayList();
  final Entity parent = ((Entity) input);
  Entity _superType = parent.getSuperType();
  boolean _notEquals = (!Objects.equal(_superType, null));
  if (_notEquals) {
   Entity _superType_1 = parent.getSuperType();
   children.add(_superType_1);
  }
  EList<Property> _properties = parent.getProperties();
  Collection<Model> _referenceModels = this.getReferenceModels(_properties);
  children.addAll(_referenceModels);
  return children;
 }
}

代码示例来源:origin: org.eclipse.vorto/boschiotsuite-gateway

public static EList<Type> getReferencedTypes(Entity entity) {
 EList<Type> types = new BasicEList<Type>();
 for (Property property : entity.getProperties()) {
  types.addAll(getReferencedTypes(property));
 }
 types.add(entity.getSuperType());
 return types;
}

代码示例来源:origin: eclipse/vorto

private static List<Property> getFlatProperties(Entity entity) {
  List<Property> properties = new ArrayList<Property>();
  TreeIterator<EObject> iter = entity.eAllContents();
  while (iter.hasNext()) {
   EObject obj = iter.next();
   if (obj instanceof Property) {
    Property property = (Property) obj;
    properties.add(property);
   }
  }
  if (entity.getSuperType() != null) {
   properties.addAll(getFlatProperties(entity.getSuperType()));
  }
  return properties;
 }
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.prosystfi

public static EList<Type> getReferencedTypes(Entity entity) {
  EList<Type> types = new BasicEList<Type>();
    for (Property property : entity.getProperties()) {
      types.addAll(getReferencedTypes(property));
    }
    types.add(entity.getSuperType());
  return types;
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.editor.datatype

@Check
public void checkCircularRefInSuperType(final Entity entity) {
 Entity _superType = entity.getSuperType();
 boolean _notEquals = (!Objects.equal(_superType, null));
 if (_notEquals) {
  try {
   Entity _superType_1 = entity.getSuperType();
   boolean _hasCircularReference = ValidatorUtils.hasCircularReference(entity, _superType_1, ValidatorUtils.entityTypeToChildrenSupplierFunction);
   if (_hasCircularReference) {
    this.error(DatatypeSystemMessage.ERROR_SUPERTYPE_CIRCULAR_REF, entity, DatatypePackage.Literals.ENTITY__SUPER_TYPE);
   }
  } catch (final Throwable _t) {
   if (_t instanceof Exception) {
    final Exception e = (Exception)_t;
    e.printStackTrace();
   } else {
    throw Exceptions.sneakyThrow(_t);
   }
  }
 }
}

代码示例来源:origin: eclipse/vorto

private static void removeSuperTypeModelReference(Entity entity) {
 Iterator<ModelReference> iter = entity.getReferences().iterator();
 while (iter.hasNext()) {
  ModelReference reference = iter.next();
  ModelReference superTypeReference =
    ModelIdFactory.newInstance(entity.getSuperType()).asModelReference();
  if (EcoreUtil.equals(superTypeReference, reference)) {
   iter.remove();
  }
 }
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen

public static EList<Type> getReferencedTypes(final Type type) {
 BasicEList<Type> types = new BasicEList<Type>();
 types.add(type);
 if ((type instanceof Entity)) {
  Entity entityType = ((Entity) type);
  EList<Property> _properties = entityType.getProperties();
  for (final Property property : _properties) {
   EList<Type> _referencedTypes = Utils.getReferencedTypes(property);
   types.addAll(_referencedTypes);
  }
  Entity _superType = entityType.getSuperType();
  types.add(_superType);
 }
 return types;
}

代码示例来源:origin: eclipse/vorto

private static List<Property> getFlatProperties(FunctionblockModel fbm) {
 List<Property> properties = new ArrayList<Property>();
 TreeIterator<EObject> iter = fbm.eAllContents();
 while (iter.hasNext()) {
  EObject obj = iter.next();
  if (obj instanceof Property) {
   Property property = (Property) obj;
   properties.add(property);
   if (property.getType() instanceof ObjectPropertyType) {
    ObjectPropertyType objectType = (ObjectPropertyType) property.getType();
    if (objectType.getType() instanceof Entity) { // only flatten entities
     Entity entity = (Entity) ((ObjectPropertyType) property.getType()).getType();
     List<Property> entityProperties = getFlatProperties(entity);
     entity.getProperties().addAll(entityProperties);
     if (entity.getSuperType() != null) {
      removeSuperTypeModelReference(entity);
     }
     entity.getProperties().stream().filter(p -> p.getType() instanceof ObjectPropertyType)
       .forEach(p -> createReference(entity, (ObjectPropertyType) p.getType()));
    }
   }
  }
 }
 if (fbm.getSuperType() != null) {
  properties.addAll(getFlatProperties(fbm.getSuperType()));
 }
 return properties;
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.templates.java

_builder.newLine();
 Entity _superType = entity.getSuperType();
 boolean _notEquals = (!Objects.equal(_superType, null));
 if (_notEquals) {
  _builder.append(_firstUpper, "");
  _builder.append(" extends ");
  Entity _superType_1 = entity.getSuperType();
  String _name_2 = _superType_1.getName();
  String _firstUpper_1 = StringExtensions.toFirstUpper(_name_2);

代码示例来源:origin: org.eclipse.vorto/generator-templates-java

_builder.newLine();
 Entity _superType = entity.getSuperType();
 boolean _tripleNotEquals = (_superType != null);
 if (_tripleNotEquals) {
  _builder.append(_firstUpper, "");
  _builder.append(" extends ");
  Entity _superType_1 = entity.getSuperType();
  String _name_2 = _superType_1.getName();
  String _firstUpper_1 = StringExtensions.toFirstUpper(_name_2);

相关文章