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

org.jinq.jpa.transform.JPQLQueryTransformConfiguration Maven / Gradle / Ivy

The newest version!
package org.jinq.jpa.transform;

import java.util.List;
import java.util.Map;

import ch.epfl.labos.iu.orm.queryll2.path.PathAnalysis;
import ch.epfl.labos.iu.orm.queryll2.symbolic.MethodSignature;
import ch.epfl.labos.iu.orm.queryll2.symbolic.TypedValue;

public class JPQLQueryTransformConfiguration
{
   public MetamodelUtil metamodel;
   /**
    * When dealing with subqueries, we may need to inspect the code of
    * lambdas used in the subquery. This may require us to use a special 
    * class loader to extract that code.
    */
   public ClassLoader alternateClassLoader;
   public boolean isObjectEqualsSafe;
   public boolean isAllEqualsSafe;
   public boolean isCollectionContainsSafe;

   public Map 
      getComparisonMethods()
   {
      return metamodel.getComparisonMethods(isObjectEqualsSafe);
   }

   public Map 
      getComparisonStaticMethods()
   {
      return metamodel.getComparisonStaticMethods(isObjectEqualsSafe);
   }

   public SymbExToColumns newSymbExToColumns(SymbExArgumentHandler argumentHandler)
   {
      return new SymbExToColumns(this, argumentHandler);
   }
   
   public SymbExToSubQuery newSymbExToSubQuery(SymbExArgumentHandler argumentHandler, boolean isExpectingStream)
   {
      return new SymbExToSubQuery(this, argumentHandler, isExpectingStream);
   }

   public Map findLambdaAsClassConstructorParameters(MethodSignature sig, List args) throws QueryTransformException
   {
      throw new IllegalArgumentException("Using classes as lambdas is not supported in Java Jinq");
   }

   public void checkLambdaSideEffects(LambdaAnalysis lambda) throws QueryTransformException
   {
      for (PathAnalysis path: lambda.symbolicAnalysis.paths)
      {
         if (!path.getSideEffects().isEmpty())
            throw new QueryTransformException("Lambda has a side-effect that can't be emulated with a database query"); 
      }
   }
   
   public JPQLQueryTransformConfiguration()
   {
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy