2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.tosca.datatypes.model;
23 import org.apache.commons.collections4.MapUtils;
25 import java.util.HashMap;
27 import java.util.Objects;
29 public class InterfaceDefinition {
32 private Map<String, PropertyDefinition> inputs;
33 private Map<String, OperationDefinition> operations;
35 public String getType() {
39 public void setType(String type) {
43 public Map<String, PropertyDefinition> getInputs() {
47 public void setInputs(
48 Map<String, PropertyDefinition> inputs) {
52 public Map<String, OperationDefinition> getOperations() {
56 public void addOperation(String operationName, OperationDefinition operationDefinition) {
57 if (MapUtils.isEmpty(this.operations)) {
58 this.operations = new HashMap<>();
60 this.operations.put(operationName, operationDefinition);
64 public boolean equals(Object o) {
68 if (!(o instanceof InterfaceDefinition)) {
71 InterfaceDefinition that = (InterfaceDefinition) o;
72 return Objects.equals(type, that.type) &&
73 Objects.equals(inputs, that.inputs) &&
74 Objects.equals(operations, that.operations);
78 public int hashCode() {
79 return Objects.hash(type, inputs, operations);