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

org.ibatis.persist.impl.predicate.BooleanAssertionPredicate 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.criteria.Expression;

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

/**
 * Predicate to assert the explicit value of a boolean expression:
    *
  • x = true
  • *
  • x = false
  • *
  • x <> true
  • *
  • x <> false
  • *
*/ public class BooleanAssertionPredicate extends AbstractSimplePredicate { private final Expression expression; private final Boolean assertedValue; public BooleanAssertionPredicate( CriteriaBuilderImpl criteriaBuilder, Expression expression, Boolean assertedValue) { super( criteriaBuilder ); this.expression = expression; this.assertedValue = assertedValue; } public Expression getExpression() { return expression; } public Boolean getAssertedValue() { return assertedValue; } @Override public void render(boolean isNegated, RenderingContext rc) { final String operator = isNegated ? " <> " : " = "; final String assertionLiteral = assertedValue ? "true" : "false"; ((Renderable) expression).render(rc); rc.append(operator).append(assertionLiteral); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy