github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/mobile/bind/testdata/interfaces.java.golden (about)

     1  // Java class go.interfaces.Interfaces is a proxy for talking to a Go program.
     2  //   gobind -lang=java interfaces
     3  //
     4  // File is generated by gobind. Do not edit.
     5  package go.interfaces;
     6  
     7  import go.Seq;
     8  
     9  public abstract class Interfaces {
    10      private Interfaces() {} // uninstantiable
    11      
    12      public static int Add3(I r) {
    13          go.Seq _in = new go.Seq();
    14          go.Seq _out = new go.Seq();
    15          int _result;
    16          _in.writeRef(r.ref());
    17          Seq.send(DESCRIPTOR, CALL_Add3, _in, _out);
    18          _result = _out.readInt32();
    19          return _result;
    20      }
    21      
    22      public static void CallErr(Error e) throws Exception {
    23          go.Seq _in = new go.Seq();
    24          go.Seq _out = new go.Seq();
    25          _in.writeRef(e.ref());
    26          Seq.send(DESCRIPTOR, CALL_CallErr, _in, _out);
    27          String _err = _out.readString();
    28          if (_err != null && !_err.isEmpty()) {
    29              throw new Exception(_err);
    30          }
    31      }
    32      
    33      public interface Error extends go.Seq.Object {
    34          public void Err() throws Exception;
    35          
    36          public static abstract class Stub implements Error {
    37              static final String DESCRIPTOR = "go.interfaces.Error";
    38              
    39              private final go.Seq.Ref ref;
    40              public Stub() {
    41                  ref = go.Seq.createRef(this);
    42              }
    43              
    44              public go.Seq.Ref ref() { return ref; }
    45              
    46              public void call(int code, go.Seq in, go.Seq out) {
    47                  switch (code) {
    48                  case Proxy.CALL_Err: {
    49                      try {
    50                          this.Err();
    51                          out.writeString(null);
    52                      } catch (Exception e) {
    53                          out.writeString(e.getMessage());
    54                      }
    55                      return;
    56                  }
    57                  default:
    58                      throw new RuntimeException("unknown code: "+ code);
    59                  }
    60              }
    61          }
    62          
    63          static final class Proxy implements Error {
    64              static final String DESCRIPTOR = Stub.DESCRIPTOR;
    65          
    66              private go.Seq.Ref ref;
    67          
    68              Proxy(go.Seq.Ref ref) { this.ref = ref; }
    69          
    70              public go.Seq.Ref ref() { return ref; }
    71          
    72              public void call(int code, go.Seq in, go.Seq out) {
    73                  throw new RuntimeException("cycle: cannot call proxy");
    74              }
    75          
    76              public void Err() throws Exception {
    77                  go.Seq _in = new go.Seq();
    78                  go.Seq _out = new go.Seq();
    79                  _in.writeRef(ref);
    80                  Seq.send(DESCRIPTOR, CALL_Err, _in, _out);
    81                  String _err = _out.readString();
    82                  if (_err != null && !_err.isEmpty()) {
    83                      throw new Exception(_err);
    84                  }
    85              }
    86              
    87              static final int CALL_Err = 0x10a;
    88          }
    89      }
    90      
    91      public interface I extends go.Seq.Object {
    92          public int Rand();
    93          
    94          public static abstract class Stub implements I {
    95              static final String DESCRIPTOR = "go.interfaces.I";
    96              
    97              private final go.Seq.Ref ref;
    98              public Stub() {
    99                  ref = go.Seq.createRef(this);
   100              }
   101              
   102              public go.Seq.Ref ref() { return ref; }
   103              
   104              public void call(int code, go.Seq in, go.Seq out) {
   105                  switch (code) {
   106                  case Proxy.CALL_Rand: {
   107                      int result = this.Rand();
   108                      out.writeInt32(result);
   109                      return;
   110                  }
   111                  default:
   112                      throw new RuntimeException("unknown code: "+ code);
   113                  }
   114              }
   115          }
   116          
   117          static final class Proxy implements I {
   118              static final String DESCRIPTOR = Stub.DESCRIPTOR;
   119          
   120              private go.Seq.Ref ref;
   121          
   122              Proxy(go.Seq.Ref ref) { this.ref = ref; }
   123          
   124              public go.Seq.Ref ref() { return ref; }
   125          
   126              public void call(int code, go.Seq in, go.Seq out) {
   127                  throw new RuntimeException("cycle: cannot call proxy");
   128              }
   129          
   130              public int Rand() {
   131                  go.Seq _in = new go.Seq();
   132                  go.Seq _out = new go.Seq();
   133                  int _result;
   134                  _in.writeRef(ref);
   135                  Seq.send(DESCRIPTOR, CALL_Rand, _in, _out);
   136                  _result = _out.readInt32();
   137                  return _result;
   138              }
   139              
   140              static final int CALL_Rand = 0x10a;
   141          }
   142      }
   143      
   144      public interface I1 extends go.Seq.Object {
   145          public void J();
   146          
   147          static final class Proxy implements I1 {
   148              static final String DESCRIPTOR = Stub.DESCRIPTOR;
   149          
   150              private go.Seq.Ref ref;
   151          
   152              Proxy(go.Seq.Ref ref) { this.ref = ref; }
   153          
   154              public go.Seq.Ref ref() { return ref; }
   155          
   156              public void call(int code, go.Seq in, go.Seq out) {
   157                  throw new RuntimeException("cycle: cannot call proxy");
   158              }
   159          
   160              public void J() {
   161                  go.Seq _in = new go.Seq();
   162                  go.Seq _out = new go.Seq();
   163                  _in.writeRef(ref);
   164                  Seq.send(DESCRIPTOR, CALL_J, _in, _out);
   165              }
   166              
   167              static final int CALL_J = 0x10a;
   168          }
   169      }
   170      
   171      public interface I2 extends go.Seq.Object {
   172          public void G();
   173          
   174          static final class Proxy implements I2 {
   175              static final String DESCRIPTOR = Stub.DESCRIPTOR;
   176          
   177              private go.Seq.Ref ref;
   178          
   179              Proxy(go.Seq.Ref ref) { this.ref = ref; }
   180          
   181              public go.Seq.Ref ref() { return ref; }
   182          
   183              public void call(int code, go.Seq in, go.Seq out) {
   184                  throw new RuntimeException("cycle: cannot call proxy");
   185              }
   186          
   187              public void G() {
   188                  go.Seq _in = new go.Seq();
   189                  go.Seq _out = new go.Seq();
   190                  _in.writeRef(ref);
   191                  Seq.send(DESCRIPTOR, CALL_G, _in, _out);
   192              }
   193              
   194              static final int CALL_G = 0x10a;
   195          }
   196      }
   197      
   198      public interface I3 extends go.Seq.Object {
   199          public I1 F();
   200          
   201          public static abstract class Stub implements I3 {
   202              static final String DESCRIPTOR = "go.interfaces.I3";
   203              
   204              private final go.Seq.Ref ref;
   205              public Stub() {
   206                  ref = go.Seq.createRef(this);
   207              }
   208              
   209              public go.Seq.Ref ref() { return ref; }
   210              
   211              public void call(int code, go.Seq in, go.Seq out) {
   212                  switch (code) {
   213                  case Proxy.CALL_F: {
   214                      I1 result = this.F();
   215                      out.writeRef(result.ref());
   216                      return;
   217                  }
   218                  default:
   219                      throw new RuntimeException("unknown code: "+ code);
   220                  }
   221              }
   222          }
   223          
   224          static final class Proxy implements I3 {
   225              static final String DESCRIPTOR = Stub.DESCRIPTOR;
   226          
   227              private go.Seq.Ref ref;
   228          
   229              Proxy(go.Seq.Ref ref) { this.ref = ref; }
   230          
   231              public go.Seq.Ref ref() { return ref; }
   232          
   233              public void call(int code, go.Seq in, go.Seq out) {
   234                  throw new RuntimeException("cycle: cannot call proxy");
   235              }
   236          
   237              public I1 F() {
   238                  go.Seq _in = new go.Seq();
   239                  go.Seq _out = new go.Seq();
   240                  I1 _result;
   241                  _in.writeRef(ref);
   242                  Seq.send(DESCRIPTOR, CALL_F, _in, _out);
   243                  _result = new I1.Proxy(_out.readRef());
   244                  return _result;
   245              }
   246              
   247              static final int CALL_F = 0x10a;
   248          }
   249      }
   250      
   251      public static I Seven() {
   252          go.Seq _in = new go.Seq();
   253          go.Seq _out = new go.Seq();
   254          I _result;
   255          Seq.send(DESCRIPTOR, CALL_Seven, _in, _out);
   256          _result = new I.Proxy(_out.readRef());
   257          return _result;
   258      }
   259      
   260      public interface WithParam extends go.Seq.Object {
   261          public void HasParam(boolean p0);
   262          
   263          public static abstract class Stub implements WithParam {
   264              static final String DESCRIPTOR = "go.interfaces.WithParam";
   265              
   266              private final go.Seq.Ref ref;
   267              public Stub() {
   268                  ref = go.Seq.createRef(this);
   269              }
   270              
   271              public go.Seq.Ref ref() { return ref; }
   272              
   273              public void call(int code, go.Seq in, go.Seq out) {
   274                  switch (code) {
   275                  case Proxy.CALL_HasParam: {
   276                      boolean param_p0;
   277                      param_p0 = in.readBool();
   278                      this.HasParam(param_p0);
   279                      return;
   280                  }
   281                  default:
   282                      throw new RuntimeException("unknown code: "+ code);
   283                  }
   284              }
   285          }
   286          
   287          static final class Proxy implements WithParam {
   288              static final String DESCRIPTOR = Stub.DESCRIPTOR;
   289          
   290              private go.Seq.Ref ref;
   291          
   292              Proxy(go.Seq.Ref ref) { this.ref = ref; }
   293          
   294              public go.Seq.Ref ref() { return ref; }
   295          
   296              public void call(int code, go.Seq in, go.Seq out) {
   297                  throw new RuntimeException("cycle: cannot call proxy");
   298              }
   299          
   300              public void HasParam(boolean p0) {
   301                  go.Seq _in = new go.Seq();
   302                  go.Seq _out = new go.Seq();
   303                  _in.writeRef(ref);
   304                  _in.writeBool(p0);
   305                  Seq.send(DESCRIPTOR, CALL_HasParam, _in, _out);
   306              }
   307              
   308              static final int CALL_HasParam = 0x10a;
   309          }
   310      }
   311      
   312      private static final int CALL_Add3 = 1;
   313      private static final int CALL_CallErr = 2;
   314      private static final int CALL_Seven = 3;
   315      private static final String DESCRIPTOR = "interfaces";
   316  }