use of org.eclipse.vorto.core.api.model.datatype.Type in project vorto by eclipse.
the class CodeGenTools method getReferencedTypes.
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;
}
use of org.eclipse.vorto.core.api.model.datatype.Type in project vorto by eclipse.
the class DatatypeGeneratorTask method getTypesOfType.
private static Set<Type> getTypesOfType(Type type, Set<Type> container) {
TreeIterator<EObject> iterator = type.eAllContents();
while (iterator.hasNext()) {
EObject current = iterator.next();
if (current instanceof ObjectPropertyType) {
if (!container.contains(current)) {
container.add(((ObjectPropertyType) current).getType());
Set<Type> moreTypes = getTypesOfType(((ObjectPropertyType) current).getType(), container);
container.addAll(moreTypes);
}
}
}
return container;
}
use of org.eclipse.vorto.core.api.model.datatype.Type in project vorto by eclipse.
the class DatatypeGeneratorTask method getTypes.
private static Set<Type> getTypes(FunctionblockModel model) {
Set<Type> allTypes = new LinkedHashSet<>();
TreeIterator<EObject> iterator = model.eAllContents();
while (iterator.hasNext()) {
EObject current = iterator.next();
if (current instanceof RefParam) {
addTypeAndReferences(((RefParam) current).getType(), allTypes);
} else if (current instanceof ReturnObjectType) {
addTypeAndReferences(((ReturnObjectType) current).getReturnType(), allTypes);
} else if (current instanceof ObjectPropertyType) {
addTypeAndReferences(((ObjectPropertyType) current).getType(), allTypes);
}
}
return allTypes;
}
use of org.eclipse.vorto.core.api.model.datatype.Type in project vorto by eclipse.
the class CodeGenTools method getReferencedTypes.
public static EList<Type> getReferencedTypes(Property property) {
EList<Type> types = new BasicEList<Type>();
if (property.getType() instanceof ObjectPropertyType) {
ObjectPropertyType objectType = (ObjectPropertyType) property.getType();
types.add(objectType.getType());
if (objectType.getType() instanceof Entity) {
types.addAll(getReferencedTypes((Entity) objectType.getType()));
}
}
return types;
}
Aggregations