use of com.torodb.kvdocument.values.KvNumeric in project torodb by torodb.
the class UpdateActionTranslator method translateMultiply.
private static void translateMultiply(CompositeUpdateAction.Builder builder, BsonDocument argument) throws UpdateException {
for (Entry<?> entry : argument) {
Collection<AttributeReference> attRefs = parseAttributeReference(entry.getKey());
KvValue<?> translatedValue = MongoWpConverter.translate(entry.getValue());
if (!(translatedValue instanceof KvNumeric)) {
throw new UpdateException("Cannot multiply with a " + "non-numeric argument");
}
builder.add(new MultiplyUpdateAction(attRefs, (KvNumeric<?>) translatedValue), false);
}
}
use of com.torodb.kvdocument.values.KvNumeric in project torodb by torodb.
the class UpdateActionTranslator method translateIncrement.
private static void translateIncrement(CompositeUpdateAction.Builder builder, BsonDocument argument) throws UpdateException {
for (Entry<?> entry : argument) {
Collection<AttributeReference> attRefs = parseAttributeReference(entry.getKey());
KvValue<?> translatedValue = MongoWpConverter.translate(entry.getValue());
if (!(translatedValue instanceof KvNumeric)) {
throw new UpdateException("Cannot increment with a " + "non-numeric argument");
}
builder.add(new IncrementUpdateAction(attRefs, (KvNumeric<?>) translatedValue), false);
}
}
Aggregations