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

it.amattioli.dominate.morphia.MorphiaObjectSpecification Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package it.amattioli.dominate.morphia;

import com.google.code.morphia.query.CriteriaContainerImpl;
import com.google.code.morphia.query.FieldEnd;

import it.amattioli.dominate.Entity;
import it.amattioli.dominate.specifications.Assembler;
import it.amattioli.dominate.specifications.ObjectSpecification;

public class MorphiaObjectSpecification > extends ObjectSpecification {

	public MorphiaObjectSpecification() {
		
	}
	
	public MorphiaObjectSpecification(String propertyName) {
		super(propertyName);
	}
	
	@Override
	public void itselfAssembleQuery(Assembler assembler) {
		if (wasSet()) {
			MorphiaAssembler mAsm = (MorphiaAssembler)assembler;
			FieldEnd criteriaField = mAsm.getQuery().criteria(getPropertyName());
			CriteriaContainerImpl criteria = criteriaField.equal(getValue());
			mAsm.addCriteria(criteria);
		}
	}

	@Override
	public boolean itselfSupportsAssembler(Assembler assembler) {
		return assembler instanceof MorphiaAssembler;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy