public TemplateQueryGenerator(final SQLDialect sqlDialect, final String sql) { final Matcher m = PARAMETER_PATTERN.matcher(sql); parameters = new ArrayList<Parameter>(); while (m.find()) { final String part = m.group("part").toUpperCase(Locale.ENGLISH); final String header = m.group("header"); final String type = m.group("type").toUpperCase(Locale.ENGLISH); DataType<?> dataType = DefaultDataType.getDataType(sqlDialect, type); if (BODY.equals(part)) { if (header != null) { throw new IllegalArgumentException("BODY parameter must have no header name specifier (${body:" + type + "}, not (${body." + header + ":" + type + "}"); } } final Parameter parameter = new Parameter(header, dataType); parameters.add(parameter); log.trace("Parameter: {}", parameter); } this.sql = m.replaceAll("?"); log.debug("Generated SQL: {}", this.sql); }
protected FakeField(String name) { super(name, new DefaultDataType<Object>(SQLDialect.DEFAULT, Object.class, "varchar")); }