use of com.datastax.oss.driver.api.mapper.annotations.Computed in project java-driver by datastax.
the class DefaultEntityFactory method getComputedFormula.
private Optional<String> getComputedFormula(Map<Class<? extends Annotation>, Annotation> annotations, ExecutableElement getMethod, @Nullable VariableElement field) {
Computed annotation = (Computed) annotations.get(Computed.class);
if (annotation != null) {
// ensure formula is non-empty
String value = annotation.value();
if (value.isEmpty()) {
Element element = field != null && field.getAnnotation(Computed.class) != null ? field : getMethod;
context.getMessager().error(element, "@Computed value should be non-empty.");
}
return Optional.of(value);
}
return Optional.empty();
}
Aggregations