1 /* 2 * ConnectionId.java 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 16 package org.rstudio.studio.client.workbench.views.connections.model; 17 18 import com.google.gwt.core.client.JavaScriptObject; 19 20 public class ConnectionId extends JavaScriptObject 21 { ConnectionId()22 protected ConnectionId() 23 { 24 } 25 create(String type, String host)26 public static native final ConnectionId create(String type, String host) /*-{ 27 return { 28 type: type, 29 host: host 30 }; 31 }-*/; 32 getType()33 public final native String getType() /*-{ 34 return this.type; 35 }-*/; 36 getHost()37 public final native String getHost() /*-{ 38 return this.host; 39 }-*/; 40 asString()41 public final String asString() 42 { 43 return getType() + " - " + getHost(); 44 } 45 equalTo(ConnectionId other)46 public final boolean equalTo(ConnectionId other) 47 { 48 return getType() == other.getType() && 49 getHost() == other.getHost(); 50 } 51 } 52