/** * Create an left in right expression * * @param <D> * @param left * @param right * @return */ public static <D> Predicate in(Expression<D> left, Collection<? extends D> right) { if (right.size() == 1) { return eqConst(left, right.iterator().next()); } else { return PredicateOperation.create(Ops.IN, left, ConstantImpl.create(right)); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public JDOUpdateClause set(List<? extends Path<?>> paths, List<?> values) { for (int i = 0; i < paths.size(); i++) { if (values.get(i) != null) { metadata.addProjection(ExpressionUtils.eqConst(((Expression)paths.get(i)), values.get(i))); } else { metadata.addProjection(ExpressionUtils.eq(((Expression)paths.get(i)), new NullExpression(paths.get(i).getType()))); } } return this; }
@Override public <T> JDOUpdateClause set(Path<T> path, T value) { if (value != null) { metadata.addProjection(ExpressionUtils.eqConst(path, value)); } else { metadata.addProjection(ExpressionUtils.eq(path, new NullExpression<T>(path.getType()))); } return this; }
/** * Create a new Query-by-example query * * @param session * @param entity */ @SuppressWarnings("unchecked") public ExampleQuery(Configuration configuration, Session session, T entity) { this.session = Assert.notNull(session, "session"); this.entityPath = (PathBuilder) pathBuilderFactory.create(entity.getClass()); this.conditions = new BooleanBuilder(); BeanMap beanMap = new BeanMap(entity); MappedClass mappedClass = configuration.getMappedClass(entity.getClass()); for (MappedPath mappedPath : mappedClass.getProperties()) { MappedProperty<?> property = mappedPath.getMappedProperty(); Object value = property.getValue(beanMap); if (value != null // date/time values are skipped && !DATE_TIME_TYPES.contains(value.getClass()) // collection values are skipped && !property.isCollection() // map values are skipped && !property.isMap() // blank nodes are skipped && !(value instanceof BID)) { Expression<Object> propertyPath = (Expression) entityPath.get(property.getName(), property.getType()); conditions.and(ExpressionUtils.eqConst(propertyPath, value)); } } }
builder.or(ExpressionUtils.eqConst((Expression) expr.getArg(0), o));
builder.or(ExpressionUtils.eqConst((Expression) expr.getArg(0), o));
builder.or(ExpressionUtils.eqConst((Expression)expr.getArg(0), o));
builder.or(ExpressionUtils.eqConst((Expression) expr.getArg(0), o));