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

com.googlecode.mjorm.mql.functions.ObjectIdVariableFunction Maven / Gradle / Ivy

package com.googlecode.mjorm.mql.functions;

import org.bson.types.ObjectId;

import com.googlecode.mjorm.mql.AbstractMqlVariableFunction;

public abstract class ObjectIdVariableFunction
	extends AbstractMqlVariableFunction {

	public static final ObjectIdVariableFunction INSTANCE = createFunction("object_id");

	public static ObjectIdVariableFunction createFunction(final String name) {
		return new ObjectIdVariableFunction() {
			@Override
			protected void init() {
				setFunctionName(name);
				setExactArgs(1);
				setTypes(String.class);
			}
		};
	}

	@Override
	protected Object doInvoke(Object[] values) {
		return new ObjectId(values[0].toString());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy