1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.method;
14 import org.simantics.databoard.type.Datatype;
\r
16 public class MethodType implements Comparable<MethodType> {
18 // RecordType, one component for each argument
21 Datatype responseType;
29 * @param requestType
\r
30 * @param responseType
\r
31 * @param errorType must be union
\r
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() {
\r
58 return requestType.toSingleLineString()+" -> " + responseType.toSingleLineString()+ " throws " + errorType.toSingleLineString();
\r
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) {