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;
28 public class InterfaceType {
29 private String derived_from;
30 private String version;
31 private Map<String, String> metadata;
32 private String description;
33 private Map<String, PropertyDefinition> inputs;
34 private Map<String, OperationDefinition> operations;
36 public Map<String, PropertyDefinition> getInputs() {
40 public void setInputs(
41 Map<String, PropertyDefinition> inputs) {
45 public String getDerived_from() {
49 public void setDerived_from(String derived_from) {
50 this.derived_from = derived_from;
53 public String getVersion() {
57 public void setVersion(String version) {
58 this.version = version;
61 public Map<String, String> getMetadata() {
65 public void setMetadata(Map<String, String> metadata) {
66 this.metadata = metadata;
69 public String getDescription() {
73 public void setDescription(String description) {
74 this.description = description;
77 public Map<String, OperationDefinition> getOperations() {
81 public void setOperations(
82 Map<String, OperationDefinition> operations) {
83 this.operations = operations;
86 public void addOperation(String operationName, OperationDefinition operationDefinition) {
87 if(MapUtils.isEmpty(this.operations)){
88 this.operations = new HashMap<>();
90 this.operations.put(operationName, operationDefinition);
94 public boolean equals(Object o) {
98 if (!(o instanceof InterfaceType)) {
102 InterfaceType that = (InterfaceType) o;
104 if (getDerived_from() != null ? !getDerived_from().equals(that.getDerived_from())
105 : that.getDerived_from() != null) {
108 if (getVersion() != null ? !getVersion().equals(that.getVersion())
109 : that.getVersion() != null) {
112 if (getMetadata() != null ? !getMetadata().equals(that.getMetadata())
113 : that.getMetadata() != null) {
116 if (getDescription() != null ? !getDescription().equals(that.getDescription())
117 : that.getDescription() != null) {
120 if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
123 return getOperations() != null ? getOperations().equals(that.getOperations())
124 : that.getOperations() == null;
128 public int hashCode() {
129 int result = getDerived_from() != null ? getDerived_from().hashCode() : 0;
130 result = 31 * result + (getVersion() != null ? getVersion().hashCode() : 0);
131 result = 31 * result + (getMetadata() != null ? getMetadata().hashCode() : 0);
132 result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
133 result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0);
134 result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);