com.wesleyhome.dao.processor.method.GetCriteriaBuilderMethodGenerator Maven / Gradle / Ivy
package com.wesleyhome.dao.processor.method;
import javax.lang.model.element.Element;
import javax.persistence.criteria.CriteriaBuilder;
import com.sun.codemodel.JBlock;
import com.sun.codemodel.JClass;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JFieldVar;
import com.sun.codemodel.JMethod;
import com.sun.codemodel.JMod;
import com.wesleyhome.dao.processor.EntityInformationMap;
import com.wesleyhome.dao.processor.model.EntityInfo;
import com.wesleyhome.dao.processor.model.MappingType;
public class GetCriteriaBuilderMethodGenerator implements MethodGenerator {
@Override
public void createMethods(final JCodeModel model, final JClass entityJClass, final JDefinedClass _class, final Element fieldElement,
final JFieldVar entityManagerField, final boolean generate, final EntityInfo entityInfo, final EntityInformationMap entityInfoMap, MappingType mappingType) {
JMethod method = _class.method(JMod.PROTECTED, CriteriaBuilder.class, "getCriteriaBuilder");
JBlock body = method.body();
body._return(entityManagerField.invoke("getCriteriaBuilder"));
}
}