Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.englishtown.vertx.promises.impl;
  
 
 
 public class DefaultWhenEventBus implements WhenEventBus {
 
     private final EventBus eventBus;
     private final Vertx vertx;
     private final Container container;
 
     @Inject
     public DefaultWhenEventBus(Vertx vertxContainer container) {
         this. = vertx;
         this. = container;
          = vertx.eventBus();
     }
 
     @Override
     public Promise<MessageVoidsend(String addressObject message) {
         final Deferred<MessageVoidd = new When<MessageVoid>().defer();
         .send(addressmessagenew Handler<Message>() {
             @Override
             public void handle(Message reply) {
                 d.getResolver().resolve(reply);
             }
         });
         return d.getPromise();
     }
 
     @Override
     public <T> Promise<Message<T>, Voidsend(String addressJsonObject message) {
         final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
         .send(addressmessagenew Handler<Message<T>>() {
             @Override
             public void handle(Message<T> reply) {
                 d.getResolver().resolve(reply);
             }
         });
         return d.getPromise();
     }
 
     @Override
     public <T> Promise<Message<T>, Voidsend(String addressJsonArray message) {
         final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
         .send(addressmessagenew Handler<Message<T>>() {
             @Override
             public void handle(Message<T> reply) {
                 d.getResolver().resolve(reply);
             }
         });
         return d.getPromise();
     }
 
     @Override
     public <T> Promise<Message<T>, Voidsend(String addressBuffer message) {
         final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
         .send(addressmessagenew Handler<Message<T>>() {
             @Override
             public void handle(Message<T> reply) {
                 d.getResolver().resolve(reply);
             }
         });
         return d.getPromise();
     }
 
     @Override
     public <T> Promise<Message<T>, Voidsend(String addressbyte[] message) {
         final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
         .send(addressmessagenew Handler<Message<T>>() {
             @Override
             public void handle(Message<T> reply) {
                 d.getResolver().resolve(reply);
             }
         });
         return d.getPromise();
     }
 
     @Override
     public <T> Promise<Message<T>, Voidsend(String addressString message) {
         final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
         .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressInteger message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressLong message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressFloat message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressDouble message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressBoolean message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressShort message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressCharacter message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public <T> Promise<Message<T>, Voidsend(String addressByte message) {
        final Deferred<Message<T>, Voidd = new When<Message<T>, Void>().defer();
        .send(addressmessagenew Handler<Message<T>>() {
            @Override
            public void handle(Message<T> reply) {
                d.getResolver().resolve(reply);
            }
        });
        return d.getPromise();
    }
    @Override
    public Promise<VoidVoidunregisterHandler(String addressHandler<? extends Messagehandler) {
        final Deferred<VoidVoidd = new When<VoidVoid>().defer();
        .unregisterHandler(addresshandlernew Handler<AsyncResult<Void>>() {
            @Override
            public void handle(AsyncResult<Voidresult) {
                if (result.succeeded()) {
                    d.getResolver().resolve((Voidnull);
                } else {
                    d.getResolver().reject(new Value<Void>(nullnew RuntimeException(result.cause())));
                }
            }
        });
        return d.getPromise();
    }
    @Override
    public Promise<VoidVoidregisterHandler(String addressHandler<? extends Messagehandler) {
        final Deferred<VoidVoidd = new When<VoidVoid>().defer();
        .registerHandler(addresshandlernew Handler<AsyncResult<Void>>() {
            @Override
            public void handle(AsyncResult<Voidresult) {
                if (result.succeeded()) {
                    d.getResolver().resolve((Voidnull);
                } else {
                    d.getResolver().reject(new Value<Void>(nullnew RuntimeException(result.cause())));
                }
            }
        });
        return d.getPromise();
    }
New to GrepCode? Check out our FAQ X