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

org.infinispan.query.dsl.impl.BaseQueryFactory Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.query.dsl.impl;

import org.infinispan.query.dsl.FilterConditionBeginContext;
import org.infinispan.query.dsl.FilterConditionContext;
import org.infinispan.query.dsl.FilterConditionEndContext;
import org.infinispan.query.dsl.Query;
import org.infinispan.query.dsl.QueryFactory;

/**
 * @author [email protected]
 * @since 6.0
 */
public abstract class BaseQueryFactory implements QueryFactory {

   @Override
   public FilterConditionEndContext having(String attributePath) {
      return new AttributeCondition(this, attributePath);
   }

   @Override
   public FilterConditionBeginContext not() {
      return new IncompleteCondition(this).not();
   }

   @Override
   public FilterConditionContext not(FilterConditionContext fcc) {
      if (fcc == null) {
         throw new IllegalArgumentException("Argument cannot be null");
      }

      BaseCondition baseCondition = ((BaseCondition) fcc).getRoot();
      if (baseCondition.queryFactory != this) {
         throw new IllegalArgumentException("The given condition was created by a different factory");
      }
      if (baseCondition.queryBuilder != null) {
         throw new IllegalArgumentException("The given condition is already in use by another builder");
      }
      NotCondition notCondition = new NotCondition(this, baseCondition);
      baseCondition.setParent(notCondition);
      return notCondition;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy