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

     1  // Java Package testpkg is a proxy for talking to a Go program.
     2  //   gobind -lang=java golang.org/x/mobile/bind/java/testpkg
     3  //
     4  // File is generated by gobind. Do not edit.
     5  package go.testpkg;
     6  
     7  import go.Seq;
     8  
     9  public abstract class Testpkg {
    10      private Testpkg() {} // uninstantiable
    11      
    12      public static long Add(long x, long y) {
    13          go.Seq _in = new go.Seq();
    14          go.Seq _out = new go.Seq();
    15          long _result;
    16          _in.writeInt(x);
    17          _in.writeInt(y);
    18          Seq.send(DESCRIPTOR, CALL_Add, _in, _out);
    19          _result = _out.readInt();
    20          return _result;
    21      }
    22      
    23      public static void Call(I i) {
    24          go.Seq _in = new go.Seq();
    25          go.Seq _out = new go.Seq();
    26          _in.writeRef(i.ref());
    27          Seq.send(DESCRIPTOR, CALL_Call, _in, _out);
    28      }
    29      
    30      public static void Err(String s) throws Exception {
    31          go.Seq _in = new go.Seq();
    32          go.Seq _out = new go.Seq();
    33          _in.writeUTF16(s);
    34          Seq.send(DESCRIPTOR, CALL_Err, _in, _out);
    35          String _err = _out.readUTF16();
    36          if (_err != null) {
    37              throw new Exception(_err);
    38          }
    39      }
    40      
    41      public static void GC() {
    42          go.Seq _in = new go.Seq();
    43          go.Seq _out = new go.Seq();
    44          Seq.send(DESCRIPTOR, CALL_GC, _in, _out);
    45      }
    46      
    47      public interface I extends go.Seq.Object {
    48          public void F();
    49          
    50          public static abstract class Stub implements I {
    51              static final String DESCRIPTOR = "go.testpkg.I";
    52              
    53              private final go.Seq.Ref ref;
    54              public Stub() {
    55                  ref = go.Seq.createRef(this);
    56              }
    57              
    58              public go.Seq.Ref ref() { return ref; }
    59              
    60              public void call(int code, go.Seq in, go.Seq out) {
    61                  switch (code) {
    62                  case Proxy.CALL_F: {
    63                      this.F();
    64                      return;
    65                  }
    66                  default:
    67                      throw new RuntimeException("unknown code: "+ code);
    68                  }
    69              }
    70          }
    71          
    72          static final class Proxy implements I {
    73              static final String DESCRIPTOR = Stub.DESCRIPTOR;
    74          
    75              private go.Seq.Ref ref;
    76          
    77              Proxy(go.Seq.Ref ref) { this.ref = ref; }
    78          
    79              public go.Seq.Ref ref() { return ref; }
    80          
    81              public void call(int code, go.Seq in, go.Seq out) {
    82                  throw new RuntimeException("cycle: cannot call proxy");
    83              }
    84          
    85              public void F() {
    86                  go.Seq _in = new go.Seq();
    87                  go.Seq _out = new go.Seq();
    88                  _in.writeRef(ref);
    89                  Seq.send(DESCRIPTOR, CALL_F, _in, _out);
    90              }
    91              
    92              static final int CALL_F = 0x10a;
    93          }
    94      }
    95      
    96      public static void Keep(I i) {
    97          go.Seq _in = new go.Seq();
    98          go.Seq _out = new go.Seq();
    99          _in.writeRef(i.ref());
   100          Seq.send(DESCRIPTOR, CALL_Keep, _in, _out);
   101      }
   102      
   103      public static S New() {
   104          go.Seq _in = new go.Seq();
   105          go.Seq _out = new go.Seq();
   106          S _result;
   107          Seq.send(DESCRIPTOR, CALL_New, _in, _out);
   108          _result = new S(_out.readRef());
   109          return _result;
   110      }
   111      
   112      public static long NumSCollected() {
   113          go.Seq _in = new go.Seq();
   114          go.Seq _out = new go.Seq();
   115          long _result;
   116          Seq.send(DESCRIPTOR, CALL_NumSCollected, _in, _out);
   117          _result = _out.readInt();
   118          return _result;
   119      }
   120      
   121      public static final class S implements go.Seq.Object {
   122          private static final String DESCRIPTOR = "go.testpkg.S";
   123          private static final int CALL_F = 0x00c;
   124          
   125          private go.Seq.Ref ref;
   126          
   127          private S(go.Seq.Ref ref) { this.ref = ref; }
   128          
   129          public go.Seq.Ref ref() { return ref; }
   130          
   131          public void call(int code, go.Seq in, go.Seq out) {
   132              throw new RuntimeException("internal error: cycle: cannot call concrete proxy");
   133          }
   134          
   135          
   136          public void F() {
   137              go.Seq _in = new go.Seq();
   138              go.Seq _out = new go.Seq();
   139              _in.writeRef(ref);
   140              Seq.send(DESCRIPTOR, CALL_F, _in, _out);
   141          }
   142          
   143          @Override public boolean equals(Object o) {
   144              if (o == null || !(o instanceof S)) {
   145                  return false;
   146              }
   147              S that = (S)o;
   148              return true;
   149          }
   150          
   151          @Override public int hashCode() {
   152              return java.util.Arrays.hashCode(new Object[] {});
   153          }
   154          
   155          @Override public String toString() {
   156              StringBuilder b = new StringBuilder();
   157              b.append("S").append("{");
   158              return b.append("}").toString();
   159          }
   160          
   161      }
   162      
   163      public static String StrDup(String s) {
   164          go.Seq _in = new go.Seq();
   165          go.Seq _out = new go.Seq();
   166          String _result;
   167          _in.writeUTF16(s);
   168          Seq.send(DESCRIPTOR, CALL_StrDup, _in, _out);
   169          _result = _out.readUTF16();
   170          return _result;
   171      }
   172      
   173      private static final int CALL_Add = 1;
   174      private static final int CALL_Call = 2;
   175      private static final int CALL_Err = 3;
   176      private static final int CALL_GC = 4;
   177      private static final int CALL_Keep = 5;
   178      private static final int CALL_New = 6;
   179      private static final int CALL_NumSCollected = 7;
   180      private static final int CALL_StrDup = 8;
   181      private static final String DESCRIPTOR = "testpkg";
   182  }