Esempio n. 1
0
 /**
  * If specimen is null, returns null. Otherwise passes it to my wrapped Guard, if there is one.
  */
 public Object coerce(Object specimen, OneArgFunc optEjector) {
   // shorten first
   specimen = Ref.resolution(specimen);
   if (null == specimen) {
     return null;
   } else if (null == myOptSubGuard) {
     throw Thrower.toEject(optEjector, "must be null");
   } else {
     return myOptSubGuard.coerce(specimen, optEjector);
   }
 }
Esempio n. 2
0
 public void accept(Mint.Purse payment) {
   Ref ackVow = E.send(myPurse, "deposit", BigInteger.valueOf(10), payment);
   Ref.whenResolvedOnly(
       ackVow,
       new OneArgFunc() {
         public Object run(Object ack) {
           T.require(!Ref.isBroken(ack), "oops");
           // ... react to being paid.
           return null;
         }
       });
 }