github.com/coming-chat/gomobile@v0.0.0-20220601074111-56995f7d7aba/bind/testdata/structs.java.golden (about) 1 // Code generated by gobind. DO NOT EDIT. 2 3 // Java class structs.S is a proxy for talking to a Go program. 4 // 5 // autogenerated by gobind -lang=java structs 6 package structs; 7 8 import go.Seq; 9 10 public final class S implements Seq.Proxy { 11 static { Structs.touch(); } 12 13 private final int refnum; 14 15 @Override public final int incRefnum() { 16 Seq.incGoRef(refnum, this); 17 return refnum; 18 } 19 20 S(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 21 22 public S() { this.refnum = __New(); Seq.trackGoRef(refnum, this); } 23 24 private static native int __New(); 25 26 public final native double getX(); 27 public final native void setX(double v); 28 29 public final native double getY(); 30 public final native void setY(double v); 31 32 public native S identity() throws Exception; 33 public native double sum(); 34 @Override public boolean equals(Object o) { 35 if (o == null || !(o instanceof S)) { 36 return false; 37 } 38 S that = (S)o; 39 double thisX = getX(); 40 double thatX = that.getX(); 41 if (thisX != thatX) { 42 return false; 43 } 44 double thisY = getY(); 45 double thatY = that.getY(); 46 if (thisY != thatY) { 47 return false; 48 } 49 return true; 50 } 51 52 @Override public int hashCode() { 53 return java.util.Arrays.hashCode(new Object[] {getX(), getY()}); 54 } 55 56 @Override public String toString() { 57 StringBuilder b = new StringBuilder(); 58 b.append("S").append("{"); 59 b.append("X:").append(getX()).append(","); 60 b.append("Y:").append(getY()).append(","); 61 return b.append("}").toString(); 62 } 63 } 64 65 // Code generated by gobind. DO NOT EDIT. 66 67 // Java class structs.S2 is a proxy for talking to a Go program. 68 // 69 // autogenerated by gobind -lang=java structs 70 package structs; 71 72 import go.Seq; 73 74 public final class S2 implements Seq.Proxy, I { 75 static { Structs.touch(); } 76 77 private final int refnum; 78 79 @Override public final int incRefnum() { 80 Seq.incGoRef(refnum, this); 81 return refnum; 82 } 83 84 S2(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 85 86 public S2() { this.refnum = __New(); Seq.trackGoRef(refnum, this); } 87 88 private static native int __New(); 89 90 public native void m(); 91 public native String string(); 92 @Override public boolean equals(Object o) { 93 if (o == null || !(o instanceof S2)) { 94 return false; 95 } 96 S2 that = (S2)o; 97 return true; 98 } 99 100 @Override public int hashCode() { 101 return java.util.Arrays.hashCode(new Object[] {}); 102 } 103 104 @Override public String toString() { 105 return string(); 106 } 107 } 108 109 // Code generated by gobind. DO NOT EDIT. 110 111 // Java class structs.Structs_ is a proxy for talking to a Go program. 112 // 113 // autogenerated by gobind -lang=java structs 114 package structs; 115 116 import go.Seq; 117 118 public final class Structs_ implements Seq.Proxy, I { 119 static { Structs.touch(); } 120 121 private final int refnum; 122 123 @Override public final int incRefnum() { 124 Seq.incGoRef(refnum, this); 125 return refnum; 126 } 127 128 Structs_(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 129 130 public Structs_() { this.refnum = __New(); Seq.trackGoRef(refnum, this); } 131 132 private static native int __New(); 133 134 public native void m(); 135 @Override public boolean equals(Object o) { 136 if (o == null || !(o instanceof Structs_)) { 137 return false; 138 } 139 Structs_ that = (Structs_)o; 140 return true; 141 } 142 143 @Override public int hashCode() { 144 return java.util.Arrays.hashCode(new Object[] {}); 145 } 146 147 @Override public String toString() { 148 StringBuilder b = new StringBuilder(); 149 b.append("Structs_").append("{"); 150 return b.append("}").toString(); 151 } 152 } 153 154 // Code generated by gobind. DO NOT EDIT. 155 156 // Java class structs.I is a proxy for talking to a Go program. 157 // 158 // autogenerated by gobind -lang=java structs 159 package structs; 160 161 import go.Seq; 162 163 public interface I { 164 public void m(); 165 166 } 167 168 // Code generated by gobind. DO NOT EDIT. 169 170 // Java class structs.Structs is a proxy for talking to a Go program. 171 // 172 // autogenerated by gobind -lang=java structs 173 package structs; 174 175 import go.Seq; 176 177 public abstract class Structs { 178 static { 179 Seq.touch(); // for loading the native library 180 _init(); 181 } 182 183 private Structs() {} // uninstantiable 184 185 // touch is called from other bound packages to initialize this package 186 public static void touch() {} 187 188 private static native void _init(); 189 190 private static final class proxyI implements Seq.Proxy, I { 191 private final int refnum; 192 193 @Override public final int incRefnum() { 194 Seq.incGoRef(refnum, this); 195 return refnum; 196 } 197 198 proxyI(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 199 200 public native void m(); 201 } 202 203 204 public static native S identity(S s); 205 public static native S identityWithError(S s) throws Exception; 206 }