Exemple #1
0
  @SuppressWarnings({"unchecked"})
  ArrayTable(Field<?> array, String alias) {
    super(alias);

    Class<?> arrayType;

    // TODO [#523] Solve this in a more object-oriented way...
    if (array.getDataType().getType().isArray()) {
      arrayType = array.getDataType().getType().getComponentType();
    }

    // [#1110] Keep track of element type information of Oracle VARRAY / TABLE types
    else if (array instanceof ArrayConstant) {
      arrayType = array.getDataType().getType();
    }

    // [#1111] Keep track of element type information of Oracle
    // VARRAY / TABLE types returned from functions
    else if (ArrayRecord.class.isAssignableFrom(array.getDataType().getType())) {
      // TODO [#523] This information should be available in ARRAY meta-data
      ArrayRecord<?> dummy =
          Utils.newArrayRecord(
              (Class<ArrayRecord<?>>) array.getDataType().getType(), new DefaultConfiguration());
      arrayType = dummy.getDataType().getType();
    }

    // Is this case possible?
    else {
      arrayType = Object.class;
    }

    this.array = array;
    this.alias = alias;
    this.field = init(alias, arrayType);

    init(alias, arrayType);
  }