requireNonNull(callback, "Callback is required."); return on(predicate, conf -> callback.run());
/** * Export configuration from an application. Useful for tooling, testing, debugging, etc... * * @param app Application to extract/collect configuration. * @return Application conf or <code>empty</code> conf on error. */ public static Config exportConf(final Jooby app) { AtomicReference<Config> conf = new AtomicReference<>(ConfigFactory.empty()); app.on("*", c -> { conf.set(c); }); exportRoutes(app); return conf.get(); }
return on(envpredicate(env), callback);
return on(envpredicate(env), callback);
/** * Run the given callback if and only if, application runs in the given environment. * * <pre> * { * on("dev", "test", "mock", () {@literal ->} { * use(new DevModule()); * }); * } * </pre> * * @param env1 Environment where we want to run the callback. * @param env2 Environment where we want to run the callback. * @param env3 Environment where we want to run the callback. * @param callback An env callback. * @return This jooby instance. */ public Jooby on(final String env1, final String env2, final String env3, final Runnable callback) { on(envpredicate(env1).or(envpredicate(env2)).or(envpredicate(env3)), callback); return this; }
requireNonNull(callback, "Callback is required."); return on(predicate, conf -> callback.run());
/** * Export configuration from an application. Useful for tooling, testing, debugging, etc... * * @param app Application to extract/collect configuration. * @return Application conf or <code>empty</code> conf on error. */ public static Config exportConf(final Jooby app) { AtomicReference<Config> conf = new AtomicReference<>(ConfigFactory.empty()); app.on("*", c -> { conf.set(c); }); exportRoutes(app); return conf.get(); }
return on(envpredicate(env), callback);
return on(envpredicate(env), callback);
/** * Run the given callback if and only if, application runs in the given environment. * * <pre> * { * on("dev", "test", "mock", () {@literal ->} { * use(new DevModule()); * }); * } * </pre> * * @param env1 Environment where we want to run the callback. * @param env2 Environment where we want to run the callback. * @param env3 Environment where we want to run the callback. * @param callback An env callback. * @return This jooby instance. */ public Jooby on(final String env1, final String env2, final String env3, final Runnable callback) { on(envpredicate(env1).or(envpredicate(env2)).or(envpredicate(env3)), callback); return this; }