1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.method;
14 import org.simantics.databoard.type.Datatype;
16 public class MethodType implements Comparable<MethodType> {
18 // RecordType, one component for each argument
21 Datatype responseType;
31 * @param errorType must be union
33 public MethodType(Datatype requestType, Datatype responseType, Datatype errorType)
35 this.requestType = requestType;
36 this.responseType = responseType;
37 this.errorType = errorType;
38 hash = requestType.hashCode() + responseType.hashCode()*13 + errorType.hashCode()*23;
41 public Datatype getRequestType()
46 public Datatype getResponseType()
51 public Datatype getErrorType()
57 public String toString() {
58 return requestType.toSingleLineString()+" -> " + responseType.toSingleLineString()+ " throws " + errorType.toSingleLineString();
63 public int hashCode() {
68 public boolean equals(Object obj) {
69 if (obj instanceof MethodType == false) return false;
70 MethodType other = (MethodType) obj;
71 return other.requestType.equals(requestType) &&
72 other.responseType.equals(responseType) &&
73 other.errorType.equals(errorType);
77 public int compareTo(MethodType o) {