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 InterfaceType {
30 private String derived_from;
31 private String version;
32 private Map<String, String> metadata;
33 private String description;
34 private Map<String, PropertyDefinition> inputs;
35 private Map<String, OperationDefinition> operations;
37 public Map<String, PropertyDefinition> getInputs() {
41 public void setInputs(
42 Map<String, PropertyDefinition> inputs) {
46 public String getDerived_from() {
50 public void setDerived_from(String derived_from) {
51 this.derived_from = derived_from;
54 public String getVersion() {
58 public void setVersion(String version) {
59 this.version = version;
62 public Map<String, String> getMetadata() {
66 public void setMetadata(Map<String, String> metadata) {
67 this.metadata = metadata;
70 public String getDescription() {
74 public void setDescription(String description) {
75 this.description = description;
78 public Map<String, OperationDefinition> getOperations() {
82 public void setOperations(
83 Map<String, OperationDefinition> operations) {
84 this.operations = operations;
87 public void addOperation(String operationName, OperationDefinition operationDefinition) {
88 if(MapUtils.isEmpty(this.operations)){
89 this.operations = new HashMap<>();
91 this.operations.put(operationName, operationDefinition);
95 public boolean equals(Object o) {
99 if (!(o instanceof InterfaceType)) {
102 InterfaceType that = (InterfaceType) o;
103 return Objects.equals(derived_from, that.derived_from) &&
104 Objects.equals(version, that.version) &&
105 Objects.equals(metadata, that.metadata) &&
106 Objects.equals(description, that.description) &&
107 Objects.equals(inputs, that.inputs) &&
108 Objects.equals(operations, that.operations);
112 public int hashCode() {
114 return Objects.hash(derived_from, version, metadata, description, inputs, operations);