throw new QueryTransformException("Jinq cannot analyze lambda constructors that transform their constructor parameters before storing them into fields"); TypedValue.ArgValue arg = (TypedValue.ArgValue)field.value; indirectParamMapping.put(field.name, args.get(arg.getIndex()));
@Override public ColumnExpressions<?> argValue(TypedValue.ArgValue val, Void in) throws TypedValueVisitorException { int index = val.getIndex(); return argHandler.handleArg(index, val.getType()); }
int parentArgIndex = paramArg.getIndex(); if (parentArgumentScope == null) throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters.");
protected ColumnExpressions<?> handleIndirectLambdaArg(int argIndex, Type argType) throws TypedValueVisitorException { // The actual value for the parameter is not available because this is a sub-lambda. // Extract the parent scope to see how the parameter is used in the parent lambda TypedValue paramVal = lambda.getIndirectCapturedArg(argIndex); // Right now, we only support sub-lambda parameters that are simply passthroughs for // parameters defined in the parent lambda. if (paramVal instanceof TypedValue.ArgValue) { TypedValue.ArgValue paramArg = (TypedValue.ArgValue)paramVal; int parentArgIndex = paramArg.getIndex(); if (parentArgumentScope == null) throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters."); // TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support // limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages // might be problematic. (Might have to pass additional parameteres to handleArg etc.) return parentArgumentScope.handleArg(parentArgIndex, argType); } else { throw new TypedValueVisitorException("Jinq can only passthrough parent lambda parameters directly to sub-lambdas. Sublambdas cannot take parameters that involve computation."); } }
protected JPQLQuery<?> handleIndirectLambdaSubQueryArg(int argIndex, Type argType) throws TypedValueVisitorException { // The actual value for the parameter is not available because this is a sub-lambda. // Extract the parent scope to see how the parameter is used in the parent lambda TypedValue paramVal = lambda.getIndirectCapturedArg(argIndex); // Right now, we only support sub-lambda parameters that are simply passthroughs for // parameters defined in the parent lambda. if (paramVal instanceof TypedValue.ArgValue) { TypedValue.ArgValue paramArg = (TypedValue.ArgValue)paramVal; int parentArgIndex = paramArg.getIndex(); if (parentArgumentScope == null) throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters."); // TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support // limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages // might be problematic. (Might have to pass additional parameteres to handleArg etc.) return parentArgumentScope.handleSubQueryArg(parentArgIndex, argType); } else { throw new TypedValueVisitorException("Jinq can only passthrough parent lambda parameters directly to sub-lambdas. Sublambdas cannot take parameters that involve computation."); } }
protected JPQLQuery<?> handleInQueryStreamSource( TypedValue methodBase, TypedValue entity) throws TypedValueVisitorException { if (!(methodBase instanceof TypedValue.ArgValue)) throw new TypedValueVisitorException("InQueryStreamSource comes from unknown source"); int index = ((TypedValue.ArgValue)methodBase).getIndex(); if (!argHandler.checkIsInQueryStreamSource(index)) throw new TypedValueVisitorException("InQueryStreamSource comes from unknown source"); if (!(entity instanceof ConstantValue.ClassConstant)) throw new TypedValueVisitorException("Streaming an unknown type"); Type type = ((ConstantValue.ClassConstant)entity).val; String entityName = config.metamodel.entityNameFromClassName(type.getClassName()); if (entityName == null) throw new TypedValueVisitorException("Streaming an unknown type"); return JPQLQuery.findAllEntities(entityName); }
@Override public ColumnExpressions<?> argValue(TypedValue.ArgValue val, SymbExPassDown in) throws TypedValueVisitorException { int index = val.getIndex(); return argHandler.handleArg(index, val.getType()); }
@Override public JPQLQuery<?> argValue(TypedValue.ArgValue val, SymbExPassDown in) throws TypedValueVisitorException { int index = val.getIndex(); return argHandler.handleSubQueryArg(index, val.getType()); }
@Override public ColumnExpressions<?> argValue(TypedValue.ArgValue val, Void in) throws TypedValueVisitorException { int index = val.getIndex(); return argHandler.handleArg(index, val.getType()); }