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.
18 package org.onap.sdc.tosca.datatypes.model;
20 import org.apache.commons.collections4.MapUtils;
22 import java.util.HashMap;
25 public class InterfaceDefinitionType extends InterfaceDefinition {
28 private Map<String, PropertyDefinition> inputs;
29 protected Map<String, OperationDefinitionType> operations;
31 public String getType() {
35 public void setType(String type) {
39 public Map<String, PropertyDefinition> getInputs() {
43 public void setInputs(
44 Map<String, PropertyDefinition> inputs) {
48 public Map<String, OperationDefinitionType> getOperations() {
52 public void setOperations(
53 Map<String, OperationDefinitionType> operations) {
54 this.operations = operations;
57 public void addOperation(String operationName, OperationDefinitionType operation) {
58 if(MapUtils.isEmpty(this.operations)) {
59 this.operations = new HashMap<>();
62 this.operations.put(operationName, operation);
66 public boolean equals(Object o) {
70 if (!(o instanceof InterfaceDefinitionType)) {
74 InterfaceDefinitionType that = (InterfaceDefinitionType) o;
76 if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) {
79 if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
82 return getOperations() != null ? getOperations().equals(that.getOperations())
83 : that.getOperations() == null;
87 public int hashCode() {
88 int result = getType() != null ? getType().hashCode() : 0;
89 result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0);
90 result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);
95 public void addOperation(String operationName, OperationDefinition operationDefinition) {
96 addOperation(operationName, (OperationDefinitionType)operationDefinition);