/** * INTERNAL * Defines the type of the parameter with the specified name. */ public void defineParameterType(String parameterName, Object parameterType, int line, int column) { if (parameterTypes.containsKey(parameterName)) { // existing entry Object oldType = parameterTypes.get(parameterName); if (typeHelper.isAssignableFrom(oldType, parameterType)) { // OK } else if (typeHelper.isAssignableFrom(parameterType, oldType)) { // new parameter type is more general parameterTypes.put(parameterName, parameterType); } else { // error case old usage and new usage do not match type throw JPQLException.invalidMultipleUseOfSameParameter( getQueryInfo(), line, column, parameterName, typeHelper.getTypeName(oldType), typeHelper.getTypeName(parameterType)); } } else { // new entry parameterTypes.put(parameterName, parameterType); } }
/** * INTERNAL * Defines the type of the parameter with the specified name. */ public void defineParameterType(String parameterName, Object parameterType, int line, int column) { if (parameterTypes.containsKey(parameterName)) { // existing entry Object oldType = parameterTypes.get(parameterName); if (typeHelper.isAssignableFrom(oldType, parameterType)) { // OK } else if (typeHelper.isAssignableFrom(parameterType, oldType)) { // new parameter type is more general parameterTypes.put(parameterName, parameterType); } else { // error case old usage and new usage do not match type throw JPQLException.invalidMultipleUseOfSameParameter( getQueryInfo(), line, column, parameterName, typeHelper.getTypeName(oldType), typeHelper.getTypeName(parameterType)); } } else { // new entry parameterTypes.put(parameterName, parameterType); } }
/** * INTERNAL * Defines the type of the parameter with the specified name. */ public void defineParameterType(String parameterName, Object parameterType, int line, int column) { if (parameterTypes.containsKey(parameterName)) { // existing entry Object oldType = parameterTypes.get(parameterName); if (typeHelper.isAssignableFrom(oldType, parameterType)) { // OK } else if (typeHelper.isAssignableFrom(parameterType, oldType)) { // new parameter type is more general parameterTypes.put(parameterName, parameterType); } else { // error case old usage and new usage do not match type throw JPQLException.invalidMultipleUseOfSameParameter( getQueryInfo(), line, column, parameterName, typeHelper.getTypeName(oldType), typeHelper.getTypeName(parameterType)); } } else { // new entry parameterTypes.put(parameterName, parameterType); } }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }