use of org.eclipse.vorto.core.api.model.functionblock.ReturnPrimitiveType in project vorto by eclipse.
the class ModelDtoFactory method createOperation.
private static Operation createOperation(org.eclipse.vorto.core.api.model.functionblock.Operation o) {
Operation operation = new Operation();
operation.setBreakable(o.isBreakable());
operation.setDescription(o.getDescription());
operation.setName(o.getName());
operation.setParams(o.getParams().stream().map(p -> createParam(p)).collect(Collectors.toList()));
if (o.getReturnType() != null) {
ReturnType returnType = new ReturnType();
returnType.setMultiple(o.getReturnType().isMultiplicity());
if (o.getReturnType() instanceof ReturnPrimitiveType) {
returnType.setPrimitive(true);
PrimitiveType pt = ((ReturnPrimitiveType) o.getReturnType()).getReturnType();
returnType.setType(org.eclipse.vorto.repository.api.content.PrimitiveType.valueOf(pt.name()));
} else {
returnType.setPrimitive(false);
returnType.setType(createModelId(((ReturnObjectType) o.getReturnType()).getReturnType()));
}
operation.setResult(returnType);
}
return operation;
}
use of org.eclipse.vorto.core.api.model.functionblock.ReturnPrimitiveType in project vorto by eclipse.
the class CoAPGenerator method generateForOperation.
private void generateForOperation(Operation op, IGeneratedWriter outputter) {
if (op.getReturnType() != null && op.getReturnType() instanceof ReturnPrimitiveType) {
primTypeWrapperRequired = true;
new JavaFBOperationReturnPrimitiveTypeWrapperGeneratorTask(op.getName() + COAP_PRIM_TYPE_WRAPPER_SUFFIX, JAVA_FILE_EXTENSION, primitiveTypeWrapperTargetPath, PRIMITIVE_TYPE_WRAPPER_PACKAGE).generate(op, null, outputter);
}
if (!op.getParams().isEmpty()) {
opParamSetRequired = true;
new JavaFBOperationParamSetGeneratorTask(op.getName() + COAP_PARAM_SET_SUFFIX, JAVA_FILE_EXTENSION, opParameterSetTargetPath, OP_PARAM_SET_PACKAGE, DT_PACKAGE).generate(op, null, outputter);
}
}
Aggregations