/** * Create a SQL "select" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlSelect toSelect(@Syntax("SQL") @Nonnull String sql);
/** * Create a DDL (schema modifying) statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue Ddl ddl(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "insert" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlInsert toInsert(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "update" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlUpdate toUpdate(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "delete" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlUpdate toDelete(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "select" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlSelect toSelect(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "delete" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlUpdate toDelete(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "update" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlUpdate toUpdate(@Syntax("SQL") @Nonnull String sql);
/** * Create a SQL "insert" statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue SqlInsert toInsert(@Syntax("SQL") @Nonnull String sql);
/** * Create a DDL (schema modifying) statement for further manipulation and execution. * Note this call does not actually execute the SQL. * * @param sql the SQL to execute, optionally containing indexed ("?") or * named (":foo") parameters. To include the characters '?' or ':' * in the SQL you must escape them with two ("??" or "::"). You * MUST be careful not to pass untrusted strings in as SQL, since * this will be executed in the database. * @return an interface for further manipulating the statement; never null */ @Nonnull @CheckReturnValue Ddl ddl(@Syntax("SQL") @Nonnull String sql);
@Override QueryOp build(QueryOpProcessor processor, @Syntax("HOCON") String args, ChannelProgressivePromise opPromise) { return new OpFilter(args, opPromise); } },
public OpFilter(@Syntax("HOCON") String args, ChannelProgressivePromise queryPromise) { super(queryPromise); try { filter = decodeObject(BundleFilter.class, args); } catch (IOException e) { throw new UncheckedIOException(e); } }
@JsonCreator public AuthenticationManagerFileWatch(@JsonProperty("path") Path path) throws IOException { this.path = path; if (path != null) { @Syntax("HOCON") String content = new String(Files.readAllBytes(path)); this.watcher = FileSystems.getDefault().newWatchService(); this.manager = Configs.decodeObject(AuthenticationManagerStatic.class, content); path.getParent().register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); log.info("Registering file watch authentication"); } else { watcher = null; } }
@Syntax("HOCON") String content = new String(Files.readAllBytes(path)); manager = Configs.decodeObject(AuthenticationManagerStatic.class, content);
@Syntax("HOCON") private static final String config = "users: [\n" + "{\n" + " name: alice\n" +
private DataSourceConstant initSource(@Syntax("HOCON") @Nonnull String config) throws IOException { DataSourceConstant src = Configs.decodeObject(DataSourceConstant.class, config); src.init(); return src; }
@Test public void basic() throws IOException { @Syntax("HTML") String html = "<html> <head> <meta charset=\"UTF-8\" /> <title>Peacock</title> " + "<LINK href=\"lib/bootstrap/bootstrap.css\" rel=\"stylesheet\" type=\"text/css\"> " + "<script type='text/javascript' src='lib/jquery.js'></script> " + "<script type='text/javascript' src='lib/underscore.js'></script> " + "<script type='text/javascript' src='lib/backbone.js'></script> " + "<script type='text/javascript' src='lib/moment.js'></script> " + "<script type='text/javascript' src='lib/bootstrap/bootstrap-dropdown.js'></script> " + "<script src='peacock.js'></script> </head> <body> <div id='peacock'></div> " + "<!--script src='demo.js'></script--> </body> </html>"; ValueFilterGrepTags grepTags = Configs.decodeObject( ValueFilterGrepTags.class, "values = [bootstrap, jquery], tagAttrs = src, tagName = script"); assertNotNull(grepTags.filterValue(ValueFactory.create(html))); ValueFilterGrepTags failGrepTags = Configs.decodeObject( ValueFilterGrepTags.class, "values = [foo, bar], tagAttrs = src, tagName = script"); assertNull(failGrepTags.filterValue(ValueFactory.create(html))); } }
@Test public void multiLineReport() throws Exception { @Syntax("HOCON") String taskDef = "source.const.bundles: {a = 3},\n" + "\n" + "map.filterOut:[\n" +