Elffuss BraidHub

kikocis/java-driver public

Document that null values are not supported in collections
Changeset64c589fc93014af0c5dbbf882c9ca89eac23cfb5a91c0b1689c0c4b0453ab44d
AuthorSylvain Lebresne <sylvain@datastax.com> · 2013-12-13 12:22 +01:00
CommitterSylvain Lebresne <sylvain@datastax.com> · 2013-12-13 14:12 +01:00
Parents29687dcadd50

Browse the files at this changeset

2 files changed

modified driver-core/src/main/java/com/datastax/driver/core/BoundStatement.java +24 −0
@@ -684,6 +684,8 @@
684684
685685 /**
686686 * Sets the {@code i}th value to the provided list.
687+ * <p>
688+ * Please note that {@code null} values are not supported inside collection by CQL.
687689 *
688690 * @param i the index of the variable to set.
689691 * @param v the value to set.
@@ -693,6 +695,8 @@
693695 * @throws InvalidTypeException if column {@code i} is not a list type or
694696 * if the elements of {@code v} are not of the type of the elements of
695697 * column {@code i}.
698+ * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections
699+ * by CQL.
696700 */
697701 public <T> BoundStatement setList(int i, List<T> v) {
698702 DataType type = metadata().getType(i);
@@ -717,6 +721,8 @@
717721
718722 /**
719723 * Sets the value for the first occurrence of column {@code name} to the provided list.
724+ * <p>
725+ * Please note that {@code null} values are not supported inside collection by CQL.
720726 *
721727 * @param name the name of the variable to set; if multiple variables
722728 * {@code name} are prepared, only the first one is set.
@@ -728,6 +734,8 @@
728734 * @throws InvalidTypeException if column {@code name} is not a list type or
729735 * if the elements of {@code v} are not of the type of the elements of
730736 * column {@code name}.
737+ * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections
738+ * by CQL.
731739 */
732740 public <T> BoundStatement setList(String name, List<T> v) {
733741 return setList(metadata().getIdx(name), v);
@@ -735,6 +743,8 @@
735743
736744 /**
737745 * Sets the {@code i}th value to the provided map.
746+ * <p>
747+ * Please note that {@code null} values are not supported inside collection by CQL.
738748 *
739749 * @param i the index of the variable to set.
740750 * @param v the value to set.
@@ -744,6 +754,8 @@
744754 * @throws InvalidTypeException if column {@code i} is not a map type or
745755 * if the elements (keys or values) of {@code v} are not of the type of the
746756 * elements of column {@code i}.
757+ * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections
758+ * by CQL.
747759 */
748760 public <K, V> BoundStatement setMap(int i, Map<K, V> v) {
749761 DataType type = metadata().getType(i);
@@ -770,6 +782,8 @@
770782
771783 /**
772784 * Sets the value for the first occurrence of column {@code name} to the provided map.
785+ * <p>
786+ * Please note that {@code null} values are not supported inside collection by CQL.
773787 *
774788 * @param name the name of the variable to set; if multiple variables
775789 * {@code name} are prepared, only the first one is set.
@@ -781,6 +795,8 @@
781795 * @throws InvalidTypeException if column {@code name} is not a map type or
782796 * if the elements (keys or values) of {@code v} are not of the type of the
783797 * elements of column {@code name}.
798+ * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections
799+ * by CQL.
784800 */
785801 public <K, V> BoundStatement setMap(String name, Map<K, V> v) {
786802 return setMap(metadata().getIdx(name), v);
@@ -788,6 +804,8 @@
788804
789805 /**
790806 * Sets the {@code i}th value to the provided set.
807+ * <p>
808+ * Please note that {@code null} values are not supported inside collection by CQL.
791809 *
792810 * @param i the index of the variable to set.
793811 * @param v the value to set.
@@ -797,6 +815,8 @@
797815 * @throws InvalidTypeException if column {@code i} is not a set type or
798816 * if the elements of {@code v} are not of the type of the elements of
799817 * column {@code i}.
818+ * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections
819+ * by CQL.
800820 */
801821 public <T> BoundStatement setSet(int i, Set<T> v) {
802822 DataType type = metadata().getType(i);
@@ -820,6 +840,8 @@
820840
821841 /**
822842 * Sets the value for the first occurrence of column {@code name} to the provided set.
843+ * <p>
844+ * Please note that {@code null} values are not supported inside collection by CQL.
823845 *
824846 * @param name the name of the variable to set; if multiple variables
825847 * {@code name} are prepared, only the first one is set.
@@ -831,6 +853,8 @@
831853 * @throws InvalidTypeException if column {@code name} is not a set type or
832854 * if the elements of {@code v} are not of the type of the elements of
833855 * column {@code name}.
856+ * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections
857+ * by CQL.
834858 */
835859 public <T> BoundStatement setSet(String name, Set<T> v) {
836860 return setSet(metadata().getIdx(name), v);
modified driver-core/src/main/java/com/datastax/driver/core/PreparedStatement.java +1 −2
@@ -167,8 +167,7 @@
167167 *
168168 * @return the newly created {@code BoundStatement}.
169169 */
170- public BoundStatement bind()
171- {
170+ public BoundStatement bind() {
172171 return new BoundStatement(this);
173172 }
174173