public FunctionDescriptor[] getConverts(FunctionMethod method, Class<?>[] types) { final List<FunctionParameter> methodTypes = method.getInputParameters(); FunctionDescriptor[] result = new FunctionDescriptor[types.length]; for(int i = 0; i < types.length; i++) { //treat all varags as the same type final String tmpTypeName = methodTypes.get(Math.min(i, methodTypes.size() - 1)).getRuntimeType(); Class<?> targetType = DataTypeManager.getDataTypeClass(tmpTypeName); Class<?> sourceType = types[i]; if (sourceType == null) { result[i] = findTypedConversionFunction(DataTypeManager.DefaultDataClasses.NULL, targetType); } else if (sourceType != targetType){ if (isVarArgArrayParam(method, types, i, targetType)) { //vararg array parameter continue; } result[i] = findTypedConversionFunction(sourceType, targetType); } } return result; }
public FunctionDescriptor[] getConverts(FunctionMethod method, Class<?>[] types) { final List<FunctionParameter> methodTypes = method.getInputParameters(); FunctionDescriptor[] result = new FunctionDescriptor[types.length]; for(int i = 0; i < types.length; i++) { //treat all varags as the same type final String tmpTypeName = methodTypes.get(Math.min(i, methodTypes.size() - 1)).getRuntimeType(); Class<?> targetType = DataTypeManager.getDataTypeClass(tmpTypeName); Class<?> sourceType = types[i]; if (sourceType == null) { result[i] = findTypedConversionFunction(DataTypeManager.DefaultDataClasses.NULL, targetType); } else if (sourceType != targetType){ if (isVarArgArrayParam(method, types, i, targetType)) { //vararg array parameter continue; } result[i] = findTypedConversionFunction(sourceType, targetType); } } return result; }
public FunctionDescriptor[] getConverts(FunctionMethod method, Class<?>[] types) { final List<FunctionParameter> methodTypes = method.getInputParameters(); FunctionDescriptor[] result = new FunctionDescriptor[types.length]; for(int i = 0; i < types.length; i++) { //treat all varags as the same type final String tmpTypeName = methodTypes.get(Math.min(i, methodTypes.size() - 1)).getRuntimeType(); Class<?> targetType = DataTypeManager.getDataTypeClass(tmpTypeName); Class<?> sourceType = types[i]; if (sourceType == null) { result[i] = findTypedConversionFunction(DataTypeManager.DefaultDataClasses.NULL, targetType); } else if (sourceType != targetType){ if (isVarArgArrayParam(method, types, i, targetType)) { //vararg array parameter continue; } result[i] = findTypedConversionFunction(sourceType, targetType); } } return result; }
/** * IMPORTANT: source and target must be basic runtime types * @param sourceExpression * @param sourceTypeName * @param targetTypeName * @param implicit * @param library * @return */ public static Function getConversion(Expression sourceExpression, String sourceTypeName, String targetTypeName, boolean implicit, FunctionLibrary library) { Class<?> srcType = DataTypeManager.getDataTypeClass(sourceTypeName); Class<?> targetType = DataTypeManager.getDataTypeClass(targetTypeName); try { setDesiredType(sourceExpression, targetType, sourceExpression); } catch (QueryResolverException e) { } FunctionDescriptor fd = library.findTypedConversionFunction(srcType, DataTypeManager.getDataTypeClass(targetTypeName)); Function conversion = new Function(fd.getName(), new Expression[] { sourceExpression, new Constant(targetTypeName) }); conversion.setType(DataTypeManager.getDataTypeClass(targetTypeName)); conversion.setFunctionDescriptor(fd); if (implicit) { conversion.makeImplicit(); } return conversion; }
/** * IMPORTANT: source and target must be basic runtime types * @param sourceExpression * @param sourceTypeName * @param targetTypeName * @param implicit * @param library * @return */ public static Function getConversion(Expression sourceExpression, String sourceTypeName, String targetTypeName, boolean implicit, FunctionLibrary library) { Class<?> srcType = DataTypeManager.getDataTypeClass(sourceTypeName); Class<?> targetType = DataTypeManager.getDataTypeClass(targetTypeName); try { setDesiredType(sourceExpression, targetType, sourceExpression); } catch (QueryResolverException e) { } FunctionDescriptor fd = library.findTypedConversionFunction(srcType, DataTypeManager.getDataTypeClass(targetTypeName)); Function conversion = new Function(fd.getName(), new Expression[] { sourceExpression, new Constant(targetTypeName) }); conversion.setType(DataTypeManager.getDataTypeClass(targetTypeName)); conversion.setFunctionDescriptor(fd); if (implicit) { conversion.makeImplicit(); } return conversion; }
/** * IMPORTANT: source and target must be basic runtime types * @param sourceExpression * @param sourceTypeName * @param targetTypeName * @param implicit * @param library * @return */ public static Function getConversion(Expression sourceExpression, String sourceTypeName, String targetTypeName, boolean implicit, FunctionLibrary library) { Class<?> srcType = DataTypeManager.getDataTypeClass(sourceTypeName); Class<?> targetType = DataTypeManager.getDataTypeClass(targetTypeName); try { setDesiredType(sourceExpression, targetType, sourceExpression); } catch (QueryResolverException e) { } FunctionDescriptor fd = library.findTypedConversionFunction(srcType, DataTypeManager.getDataTypeClass(targetTypeName)); Function conversion = new Function(fd.getName(), new Expression[] { sourceExpression, new Constant(targetTypeName) }); conversion.setType(DataTypeManager.getDataTypeClass(targetTypeName)); conversion.setFunctionDescriptor(fd); if (implicit) { conversion.makeImplicit(); } return conversion; }
String dataType = (String) ((Constant)args[1]).getValue(); Class<?> dataTypeClass = metadata.getDataTypeClass(dataType); fd = library.findTypedConversionFunction(args[0].getType(), dataTypeClass);
String dataType = (String) ((Constant)args[1]).getValue(); Class<?> dataTypeClass = metadata.getDataTypeClass(dataType); fd = library.findTypedConversionFunction(args[0].getType(), dataTypeClass);
String dataType = (String) ((Constant)args[1]).getValue(); Class<?> dataTypeClass = metadata.getDataTypeClass(dataType); fd = library.findTypedConversionFunction(args[0].getType(), dataTypeClass);