github.com/c-darwin/mobile@v0.0.0-20160313183840-ff625c46f7c9/bind/testdata/issue10788.java.golden (about) 1 // Java Package issue10788 is a proxy for talking to a Go program. 2 // gobind -lang=java issue10788 3 // 4 // File is generated by gobind. Do not edit. 5 package go.issue10788; 6 7 import go.Seq; 8 9 public abstract class Issue10788 { 10 private Issue10788() {} // uninstantiable 11 12 public interface TestInterface extends go.Seq.Object { 13 public void DoSomeWork(TestStruct s); 14 15 public void MultipleUnnamedParams(long p0, String p1, long p2); 16 17 public static abstract class Stub implements TestInterface { 18 static final String DESCRIPTOR = "go.issue10788.TestInterface"; 19 20 private final go.Seq.Ref ref; 21 public Stub() { 22 ref = go.Seq.createRef(this); 23 } 24 25 public go.Seq.Ref ref() { return ref; } 26 27 public void call(int code, go.Seq in, go.Seq out) { 28 switch (code) { 29 case Proxy.CALL_DoSomeWork: { 30 TestStruct param_s; 31 param_s = new TestStruct(in.readRef()); 32 this.DoSomeWork(param_s); 33 return; 34 } 35 case Proxy.CALL_MultipleUnnamedParams: { 36 long param_p0; 37 param_p0 = in.readInt(); 38 String param_p1; 39 param_p1 = in.readString(); 40 long param_p2; 41 param_p2 = in.readInt64(); 42 this.MultipleUnnamedParams(param_p0, param_p1, param_p2); 43 return; 44 } 45 default: 46 throw new RuntimeException("unknown code: "+ code); 47 } 48 } 49 } 50 51 static final class Proxy implements TestInterface { 52 static final String DESCRIPTOR = Stub.DESCRIPTOR; 53 54 private go.Seq.Ref ref; 55 56 Proxy(go.Seq.Ref ref) { this.ref = ref; } 57 58 public go.Seq.Ref ref() { return ref; } 59 60 public void call(int code, go.Seq in, go.Seq out) { 61 throw new RuntimeException("cycle: cannot call proxy"); 62 } 63 64 public void DoSomeWork(TestStruct s) { 65 go.Seq _in = new go.Seq(); 66 go.Seq _out = new go.Seq(); 67 _in.writeRef(ref); 68 _in.writeRef(s.ref()); 69 Seq.send(DESCRIPTOR, CALL_DoSomeWork, _in, _out); 70 } 71 72 public void MultipleUnnamedParams(long p0, String p1, long p2) { 73 go.Seq _in = new go.Seq(); 74 go.Seq _out = new go.Seq(); 75 _in.writeRef(ref); 76 _in.writeInt(p0); 77 _in.writeString(p1); 78 _in.writeInt64(p2); 79 Seq.send(DESCRIPTOR, CALL_MultipleUnnamedParams, _in, _out); 80 } 81 82 static final int CALL_DoSomeWork = 0x10a; 83 static final int CALL_MultipleUnnamedParams = 0x20a; 84 } 85 } 86 87 public static final class TestStruct implements go.Seq.Object { 88 private static final String DESCRIPTOR = "go.issue10788.TestStruct"; 89 private static final int FIELD_Value_GET = 0x00f; 90 private static final int FIELD_Value_SET = 0x01f; 91 92 private go.Seq.Ref ref; 93 94 private TestStruct(go.Seq.Ref ref) { this.ref = ref; } 95 96 public go.Seq.Ref ref() { return ref; } 97 98 public void call(int code, go.Seq in, go.Seq out) { 99 throw new RuntimeException("internal error: cycle: cannot call concrete proxy"); 100 } 101 102 public String getValue() { 103 Seq in = new Seq(); 104 Seq out = new Seq(); 105 in.writeRef(ref); 106 Seq.send(DESCRIPTOR, FIELD_Value_GET, in, out); 107 return out.readString(); 108 } 109 110 public void setValue(String v) { 111 Seq in = new Seq(); 112 Seq out = new Seq(); 113 in.writeRef(ref); 114 in.writeString(v); 115 Seq.send(DESCRIPTOR, FIELD_Value_SET, in, out); 116 } 117 118 @Override public boolean equals(Object o) { 119 if (o == null || !(o instanceof TestStruct)) { 120 return false; 121 } 122 TestStruct that = (TestStruct)o; 123 String thisValue = getValue(); 124 String thatValue = that.getValue(); 125 if (thisValue == null) { 126 if (thatValue != null) { 127 return false; 128 } 129 } else if (!thisValue.equals(thatValue)) { 130 return false; 131 } 132 return true; 133 } 134 135 @Override public int hashCode() { 136 return java.util.Arrays.hashCode(new Object[] {getValue()}); 137 } 138 139 @Override public String toString() { 140 StringBuilder b = new StringBuilder(); 141 b.append("TestStruct").append("{"); 142 b.append("Value:").append(getValue()).append(","); 143 return b.append("}").toString(); 144 } 145 146 } 147 148 private static final String DESCRIPTOR = "issue10788"; 149 }