use of org.eclipse.winery.model.tosca.yaml.YTOperationDefinition in project winery by eclipse.
the class YamlBuilder method buildOperationDefinition.
@Nullable
@SuppressWarnings("unchecked")
public YTOperationDefinition buildOperationDefinition(Object object, Parameter<YTOperationDefinition> parameter) {
if (Objects.isNull(object) || !validate(YTOperationDefinition.class, object, parameter)) {
return null;
}
if (!(object instanceof Map)) {
return null;
}
Map<String, Object> map = (Map<String, Object>) object;
String description = buildDescription(map.get(YamlSpecKeywords.DESCRIPTION));
Map<String, YTParameterDefinition> inputs = buildParameterDefinitions(map.get(YamlSpecKeywords.INPUTS), new Parameter<>(parameter.getContext()).addContext(YamlSpecKeywords.INPUTS).setValue(parameter.getValue()));
Map<String, YTParameterDefinition> outputs = buildParameterDefinitions(map.get(YamlSpecKeywords.OUTPUTS), new Parameter<>(parameter.getContext()).addContext(YamlSpecKeywords.OUTPUTS).setValue(parameter.getValue()));
YTImplementation implementation = buildImplementation(map.get(YamlSpecKeywords.IMPLEMENTATION), new Parameter<YTImplementation>(parameter.getContext()).addContext(YamlSpecKeywords.IMPLEMENTATION));
return new YTOperationDefinition.Builder().setDescription(description).setInputs(inputs).setOutputs(outputs).setImplementation(implementation).build();
}
Aggregations