@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TInterfaceDefinition)) return false; TInterfaceDefinition that = (TInterfaceDefinition) o; return Objects.equals(getType(), that.getType()) && Objects.equals(getInputs(), that.getInputs()) && Objects.equals(getOperations(), that.getOperations()); }
@Override public int hashCode() { return Objects.hash(getType(), getInputs(), getOperations()); }
@Override public String toString() { return "TInterfaceDefinition{" + "type=" + getType() + ", inputs=" + getInputs() + ", operations=" + getOperations() + '}'; }
/** * Converts TOSCA YAML InterfaceDefinitions to TOSCA XML Interface Additional TOSCA YAML element input with * PropertyAssignment or PropertyDefinition is not converted * * @param node TOSCA YAML InterfaceDefinition * @return TOSCA XML Interface */ private TInterface convert(TInterfaceDefinition node, String id) { List<TOperation> operation = new ArrayList<>(); if (this.interfaceTypes.containsKey(node.getType())) { operation.addAll(convert(this.interfaceTypes.get(node.getType()).getOperations())); } operation.addAll(convert(node.getOperations())); TInterface.Builder builder = new TInterface.Builder(id, operation); return builder.build(); }
public Printer visit(TInterfaceDefinition node, Parameter parameter) { return new Printer(parameter.getIndent()) .printKeyValue("type", node.getType()) .print(printMap("inputs", node.getInputs(), parameter)) .print(node.getOperations().entrySet().stream() .filter(entry -> Objects.nonNull(entry) && Objects.nonNull(entry.getValue())) .map(entry -> printVisitorNode(entry.getValue(), new Parameter(parameter.getIndent()).addContext(entry.getKey())) ) .reduce(Printer::print) ); }