Skip to content

Commit 5484618

Browse files
committed
Change Computed annotation to use default attribute name.
1 parent 93313f6 commit 5484618

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

driver-mapping/src/main/java/com/datastax/driver/mapping/AnnotationChecks.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ static void checkFrozenTypes(Field field) {
103103

104104
static void checkValidComputed(Field field) {
105105
Computed computed = field.getAnnotation(Computed.class);
106-
if (computed != null && computed.formula().isEmpty()){
107-
throw new IllegalArgumentException(String.format("Field %s: attribute 'formula' of annotation @Computed is mandatory for computed fields", field.getName()));
106+
if (computed != null && computed.value().isEmpty()){
107+
throw new IllegalArgumentException(String.format("Field %s: attribute 'value' of annotation @Computed is mandatory for computed fields", field.getName()));
108108
}
109109
}
110110

driver-mapping/src/main/java/com/datastax/driver/mapping/AnnotationParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static String columnName(Field field) {
233233
}
234234

235235
if (computedField != null) {
236-
return computedField.formula();
236+
return computedField.value();
237237
}
238238

239239
return field.getName().toLowerCase();

driver-mapping/src/main/java/com/datastax/driver/mapping/annotations/Computed.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
*
4747
* @return the formula.
4848
*/
49-
String formula();
49+
String value();
5050
}

driver-mapping/src/test/java/com/datastax/driver/mapping/MapperComputedFieldsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ public User(String login, String name) {
162162

163163
// quotes in the column name inserted on purpose
164164
// to test the alias generation mechanism
165-
@Computed(formula = "writetime(\"name\")")
165+
@Computed(value = "writetime(\"name\")")
166166
long writeTime;
167167

168-
@Computed(formula = "ttl(name)")
168+
@Computed("ttl(name)")
169169
Integer ttl;
170170

171171
public String getLogin() {

0 commit comments

Comments
 (0)