@SuppressWarnings("unchecked") private Object deserializeList(BValueArray jArray, Class<?> targetType, List targetList) { Class<?> componentType = targetType.getComponentType(); for (BRefType<?> value : jArray.getValues()) { Object item = deserialize(value, componentType); targetList.add(item); } return targetList; }
public static <T> T[] getRecodeArrayArgumentNative(Context context, int index, IntFunction<T[]> generator) { BValueArray refArray = (BValueArray) context.getRefArgument(index); T[] nativeArray = generator.apply((int) refArray.size()); BRefType<?>[] values = refArray.getValues(); for (int i = 0; i < refArray.size(); i++) { BRefType<?> bRefType = values[i]; nativeArray[i] = getaNative(bRefType); } return nativeArray; }
private static boolean checkIsLikeArrayType(BValue sourceValue, BArrayType targetType) { if (!(sourceValue instanceof BValueArray)) { return false; } BValueArray source = (BValueArray) sourceValue; if (BTypes.isValueType(source.elementType)) { return checkIsType(source.elementType, targetType.getElementType(), new ArrayList<>()); } BType arrayElementType = targetType.getElementType(); BRefType<?>[] arrayValues = source.getValues(); for (int i = 0; i < ((BValueArray) sourceValue).size(); i++) { if (!checkIsLikeType(arrayValues[i], arrayElementType)) { return false; } } return true; }
private static boolean checkIsLikeJSONType(BValue sourceValue, BJSONType targetType) { if (targetType.getConstrainedType() != null) { return checkIsLikeType(sourceValue, targetType.getConstrainedType()); } else if (sourceValue.getType().getTag() == TypeTags.ARRAY_TAG) { BValueArray source = (BValueArray) sourceValue; if (BTypes.isValueType(source.elementType)) { return checkIsType(source.elementType, targetType, new ArrayList<>()); } BRefType<?>[] arrayValues = source.getValues(); for (int i = 0; i < ((BValueArray) sourceValue).size(); i++) { if (!checkIsLikeType(arrayValues[i], targetType)) { return false; } } } else if (sourceValue.getType().getTag() == TypeTags.MAP_TAG) { for (BValue value : ((BMap) sourceValue).values()) { if (!checkIsLikeType(value, targetType)) { return false; } } } else if (sourceValue.getType().getTag() == TypeTags.RECORD_TYPE_TAG) { for (Object object : ((BMap) sourceValue).getMap().values()) { if (!checkIsLikeType((BValue) object, targetType)) { return false; } } } return true; }
BRefType<?>[] arrayValues = this.getValues(); for (int i = 0; i < this.size(); i++) { if (arrayValues[i] != null) { BRefType<?>[] arrayValues = this.getValues(); for (int i = 0; i < this.size(); i++) { if (arrayValues[i] != null) { BRefType<?>[] arrayValues = this.getValues(); for (int i = 0; i < this.size(); i++) { if (arrayValues[i] != null) {
private void moveRefValueArrayToBasicTypeArray(BType type, BType arrayElementType) { BRefType<?>[] arrayValues = this.getValues();