@Override public Matcher visit(final com.amalto.core.query.user.Compare condition) { final String value = condition .getRight() .accept( new VisitorAdapter<String>() { @Override public String visit(StringConstant constant) { return constant.getValue(); } @Override public String visit(IntegerConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(DateConstant constant) { synchronized (DateConstant.DATE_FORMAT) { return DateConstant.DATE_FORMAT.format(constant.getValue()); } } @Override public String visit(DateTimeConstant constant) { synchronized (DateTimeConstant.DATE_FORMAT) { return DateTimeConstant.DATE_FORMAT.format(constant.getValue()); } } @Override public String visit(BooleanConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(BigDecimalConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(TimeConstant constant) { synchronized (TimeConstant.TIME_FORMAT) { return TimeConstant.TIME_FORMAT.format(constant.getValue()); } } @Override public String visit(ShortConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(ByteConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(LongConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(DoubleConstant constant) { return String.valueOf(constant.getValue()); } @Override public String visit(FloatConstant constant) { return String.valueOf(constant.getValue()); } }); return condition .getLeft() .accept( new VisitorAdapter<Matcher>() { @Override public Matcher visit(StagingBlockKey stagingBlockKey) { return new BuiltInBlockKeyMatcher(condition.getPredicate(), value); } @Override public Matcher visit(Field field) { return new CompareMatcher( field.getFieldMetadata(), condition.getPredicate(), value); } }); }
@Override public Collection<? extends ComplexTypeMetadata> visit(Compare condition) { condition.getLeft().accept(this); condition.getRight().accept(this); return closure; }