All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.mjorm.query.modifiers.BitwiseModifier Maven / Gradle / Ivy

package com.googlecode.mjorm.query.modifiers;

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;

public class BitwiseModifier
	extends AbstractModifier {

	private Operation operation;
	private Number value;

	public BitwiseModifier(Operation operation, Number value) {
		this.operation 	= operation;
		this.value		= value;
	}

	@Override
	public DBObject toModifierObject(String propertyName) {
		return new BasicDBObject("$bit",
			new BasicDBObject(propertyName,
				new BasicDBObject(operation.getValue(), value)));
	}

	public enum Operation {
		AND("and"),
		OR("or")
		;
		String value;
		Operation(String value) {
			this.value = value;
		}
		public String getValue() {
			return this.value;
		}
		
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy