2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.tosca.datatypes.model;
19 import org.apache.commons.collections4.MapUtils;
21 import java.util.HashMap;
24 public class InterfaceDefinitionType extends InterfaceDefinition {
27 private Map<String, PropertyDefinition> inputs;
28 protected Map<String, OperationDefinitionType> operations;
30 public String getType() {
34 public void setType(String type) {
38 public Map<String, PropertyDefinition> getInputs() {
42 public void setInputs(
43 Map<String, PropertyDefinition> inputs) {
47 public Map<String, OperationDefinitionType> getOperations() {
51 public void setOperations(
52 Map<String, OperationDefinitionType> operations) {
53 this.operations = operations;
56 public void addOperation(String operationName, OperationDefinitionType operation) {
57 if(MapUtils.isEmpty(this.operations)) {
58 this.operations = new HashMap<>();
61 this.operations.put(operationName, operation);
65 public boolean equals(Object o) {
69 if (!(o instanceof InterfaceDefinitionType)) {
73 InterfaceDefinitionType that = (InterfaceDefinitionType) o;
75 if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) {
78 if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
81 return getOperations() != null ? getOperations().equals(that.getOperations())
82 : that.getOperations() == null;
86 public int hashCode() {
87 int result = getType() != null ? getType().hashCode() : 0;
88 result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0);
89 result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);
94 public void addOperation(String operationName, OperationDefinition operationDefinition) {
95 addOperation(operationName, (OperationDefinitionType)operationDefinition);