public ConstraintBuilder toPosition(Validator<Position> positionValidator) {
        Constraint newConstraint = null;

        if (object != null) {
            newConstraint = new SingleObjectPositionConstraint(object.getId(), positionValidator);
        } else if (objects != null) {
            List<Constraint> constraints = newArrayList();
            for (DataObject object : objects) {
                constraints.add(new SingleObjectPositionConstraint(object.getId(), positionValidator));
            }
            if (all) {
                newConstraint = new CompositeAllConstraint(constraints);
            } else {
                newConstraint = new CompositeAnyConstraint(constraints);
            }
        }

        buildCurrentConstraint(newConstraint);
        return this;
    }