use of org.apache.asterix.om.pointables.AFlatValuePointable in project asterixdb by apache.
the class JavaFunctionHelper method setArgument.
public void setArgument(int index, IValueReference valueReference) throws IOException, AsterixException {
IVisitablePointable pointable = null;
IJObject jObject = null;
IAType type = finfo.getParamList().get(index);
switch(type.getTypeTag()) {
case OBJECT:
pointable = pointableAllocator.allocateRecordValue(type);
pointable.set(valueReference);
jObject = pointableVisitor.visit((ARecordVisitablePointable) pointable, getTypeInfo(index, type));
break;
case ARRAY:
case MULTISET:
pointable = pointableAllocator.allocateListValue(type);
pointable.set(valueReference);
jObject = pointableVisitor.visit((AListVisitablePointable) pointable, getTypeInfo(index, type));
break;
case ANY:
throw new RuntimeDataException(ErrorCode.LIBRARY_JAVA_FUNCTION_HELPER_CANNOT_HANDLE_ARGU_TYPE, type.getTypeTag());
default:
pointable = pointableAllocator.allocateFieldValue(type);
pointable.set(valueReference);
jObject = pointableVisitor.visit((AFlatValuePointable) pointable, getTypeInfo(index, type));
break;
}
arguments[index] = jObject;
}
Aggregations