github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/mobile/bind/testdata/structs.java.golden (about) 1 // Java class go.structs.Structs is a proxy for talking to a Go program. 2 // gobind -lang=java structs 3 // 4 // File is generated by gobind. Do not edit. 5 package go.structs; 6 7 import go.Seq; 8 9 public abstract class Structs { 10 private Structs() {} // uninstantiable 11 12 public static S Identity(S s) { 13 go.Seq _in = new go.Seq(); 14 go.Seq _out = new go.Seq(); 15 S _result; 16 _in.writeRef(s.ref()); 17 Seq.send(DESCRIPTOR, CALL_Identity, _in, _out); 18 _result = new S(_out.readRef()); 19 return _result; 20 } 21 22 public static S IdentityWithError(S s) throws Exception { 23 go.Seq _in = new go.Seq(); 24 go.Seq _out = new go.Seq(); 25 S _result; 26 _in.writeRef(s.ref()); 27 Seq.send(DESCRIPTOR, CALL_IdentityWithError, _in, _out); 28 _result = new S(_out.readRef()); 29 String _err = _out.readString(); 30 if (_err != null && !_err.isEmpty()) { 31 throw new Exception(_err); 32 } 33 return _result; 34 } 35 36 public static final class S implements go.Seq.Object { 37 private static final String DESCRIPTOR = "go.structs.S"; 38 private static final int FIELD_X_GET = 0x00f; 39 private static final int FIELD_X_SET = 0x01f; 40 private static final int FIELD_Y_GET = 0x10f; 41 private static final int FIELD_Y_SET = 0x11f; 42 private static final int CALL_Identity = 0x00c; 43 private static final int CALL_Sum = 0x10c; 44 45 private go.Seq.Ref ref; 46 47 private S(go.Seq.Ref ref) { this.ref = ref; } 48 49 public go.Seq.Ref ref() { return ref; } 50 51 public void call(int code, go.Seq in, go.Seq out) { 52 throw new RuntimeException("internal error: cycle: cannot call concrete proxy"); 53 } 54 55 public double getX() { 56 Seq in = new Seq(); 57 Seq out = new Seq(); 58 in.writeRef(ref); 59 Seq.send(DESCRIPTOR, FIELD_X_GET, in, out); 60 return out.readFloat64(); 61 } 62 63 public void setX(double v) { 64 Seq in = new Seq(); 65 Seq out = new Seq(); 66 in.writeRef(ref); 67 in.writeFloat64(v); 68 Seq.send(DESCRIPTOR, FIELD_X_SET, in, out); 69 } 70 71 public double getY() { 72 Seq in = new Seq(); 73 Seq out = new Seq(); 74 in.writeRef(ref); 75 Seq.send(DESCRIPTOR, FIELD_Y_GET, in, out); 76 return out.readFloat64(); 77 } 78 79 public void setY(double v) { 80 Seq in = new Seq(); 81 Seq out = new Seq(); 82 in.writeRef(ref); 83 in.writeFloat64(v); 84 Seq.send(DESCRIPTOR, FIELD_Y_SET, in, out); 85 } 86 87 public S Identity() throws Exception { 88 go.Seq _in = new go.Seq(); 89 go.Seq _out = new go.Seq(); 90 S _result; 91 _in.writeRef(ref); 92 Seq.send(DESCRIPTOR, CALL_Identity, _in, _out); 93 _result = new S(_out.readRef()); 94 String _err = _out.readString(); 95 if (_err != null && !_err.isEmpty()) { 96 throw new Exception(_err); 97 } 98 return _result; 99 } 100 101 public double Sum() { 102 go.Seq _in = new go.Seq(); 103 go.Seq _out = new go.Seq(); 104 double _result; 105 _in.writeRef(ref); 106 Seq.send(DESCRIPTOR, CALL_Sum, _in, _out); 107 _result = _out.readFloat64(); 108 return _result; 109 } 110 111 @Override public boolean equals(Object o) { 112 if (o == null || !(o instanceof S)) { 113 return false; 114 } 115 S that = (S)o; 116 double thisX = getX(); 117 double thatX = that.getX(); 118 if (thisX != thatX) { 119 return false; 120 } 121 double thisY = getY(); 122 double thatY = that.getY(); 123 if (thisY != thatY) { 124 return false; 125 } 126 return true; 127 } 128 129 @Override public int hashCode() { 130 return java.util.Arrays.hashCode(new Object[] {getX(), getY()}); 131 } 132 133 @Override public String toString() { 134 StringBuilder b = new StringBuilder(); 135 b.append("S").append("{"); 136 b.append("X:").append(getX()).append(","); 137 b.append("Y:").append(getY()).append(","); 138 return b.append("}").toString(); 139 } 140 141 } 142 143 private static final int CALL_Identity = 1; 144 private static final int CALL_IdentityWithError = 2; 145 private static final String DESCRIPTOR = "structs"; 146 }