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

org.ibatis.persist.impl.predicate.BooleanStaticAssertionPredicate Maven / Gradle / Ivy

Go to download

The jBATIS persistence framework will help you to significantly reduce the amount of Java code that you normally need to access a relational database. iBATIS simply maps JavaBeans to SQL statements using a very simple XML descriptor.

The newest version!
package org.ibatis.persist.impl.predicate;

import org.ibatis.persist.impl.CriteriaBuilderImpl;
import org.ibatis.persist.impl.RenderingContext;

/**
 * Predicate used to assert a static boolean condition.
 */
public class BooleanStaticAssertionPredicate
		extends AbstractSimplePredicate {
	private final Boolean assertedValue;

	public BooleanStaticAssertionPredicate(
			CriteriaBuilderImpl criteriaBuilder,
			Boolean assertedValue) {
		super( criteriaBuilder );
		this.assertedValue = assertedValue;
	}

	public Boolean getAssertedValue() {
		return assertedValue;
	}

	@Override
    public void render(boolean isNegated, RenderingContext rc) {
        boolean isTrue = getAssertedValue();
        if (isNegated) {
            isTrue = !isTrue;
        }
        rc.append(isTrue ? "1=1" : "0=1");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy