Elffuss BraidHub

kikocis/java-driver public

Allow empty name on Column and Field annotations (JAVA-528).
Changesetf61d1e15a96e2482675fa5c349313055a98444b258238c76813873e1af7931f8
Authorolim7t <omichallat+github@gmail.com> · 2014-11-07 20:38 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2014-11-07 20:38 +01:00
Parentsd571a5db2aef

Browse the files at this changeset

4 files changed

modified driver-core/CHANGELOG.rst +1 −0
@@ -7,6 +7,7 @@
77 - [bug] Ignore static fields in mapper (JAVA-510)
88 - [bug] Fix UDT parsing at init when using the default protocol version (JAVA-509)
99 - [bug] Fix toString, equals and hashCode on accessor proxies (JAVA-495)
10+- [bug] Allow empty name on Column and Field annotations (JAVA-528)
1011
1112 Merged from 2.0 branch:
1213
modified driver-mapping/src/main/java/com/datastax/driver/mapping/AnnotationParser.java +2 −2
@@ -210,12 +210,12 @@
210210
211211 public static String columnName(Field field) {
212212 Column column = field.getAnnotation(Column.class);
213- if (column != null) {
213+ if (column != null && !column.name().isEmpty()) {
214214 return column.caseSensitive() ? column.name() : column.name().toLowerCase();
215215 }
216216
217217 com.datastax.driver.mapping.annotations.Field udtField = field.getAnnotation(com.datastax.driver.mapping.annotations.Field.class);
218- if (udtField != null) {
218+ if (udtField != null && !udtField.name().isEmpty()) {
219219 return udtField.caseSensitive() ? udtField.name() : udtField.name().toLowerCase();
220220 }
221221
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +1 −0
@@ -68,6 +68,7 @@
6868
6969 private String name;
7070 private String email;
71+ @Column // not strictly required, but we want to check that the annotation works without a name
7172 private int year;
7273
7374 private Gender gender;
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java +1 −0
@@ -127,6 +127,7 @@
127127
128128 private String street;
129129
130+ @Field // not strictly required, but we want to check that the annotation works without a name
130131 private String city;
131132
132133 @Field(name = "zip_code")