File: PLSQLCollection.java

package info (click to toggle)
eclipselink 2.7.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 44,820 kB
  • sloc: java: 477,843; xml: 503; makefile: 21
file content (95 lines) | stat: -rw-r--r-- 2,676 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0,
 * or the Eclipse Distribution License v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
 */

// Contributors:
//     Oracle - Dec 2008 proof-of-concept
package org.eclipse.persistence.platform.database.oracle.plsql;

//javase imports
import static java.sql.Types.ARRAY;

import java.util.ArrayList;

//EclipseLink imports
import org.eclipse.persistence.internal.helper.ComplexDatabaseType;
import org.eclipse.persistence.internal.helper.DatabaseType;

/**
 * <b>PUBLIC</b>: Marker interface for Oracle PL/SQL Collections (Nested Tables and Varrays)
 *
 */
public class PLSQLCollection extends ComplexDatabaseType implements Cloneable, OraclePLSQLType {

    /**
     * Defines the database type of the value contained in the collection type.
     * <p>i.e. the OF type.
     * <p>This could be a JDBC type, PLSQL type, or a PLSQL RECORD type.
     */
    protected DatabaseType nestedType;
    protected boolean isNestedTable = false;

    /**
     * The default constructor sets javaType to ArrayList.class
     */
    public PLSQLCollection() {
        super();
        this.javaType = ArrayList.class;
    }

    @Override
    public PLSQLCollection clone()  {
        PLSQLCollection clone = (PLSQLCollection)super.clone();
        return clone;
    }

    @Override
    public boolean isCollection() {
        return true;
    }

    /**
     * Indicates if the instance represents a Nested Table (as opposed to Varray).
     * Defaults to false, i.e. Varray.
     */
    public boolean isNestedTable() {
        return isNestedTable;
    }

    /**
     * Return the database type of the value contained in the collection type.
     */
    public DatabaseType getNestedType() {
        return nestedType;
    }

    /**
     * Set boolean that indicates if the instance represents a Nested Table
     * (as opposed to Varray)
     */
    public void setIsNestedTable(boolean isNestedTable) {
        this.isNestedTable = isNestedTable;
    }

    /**
     * Set the database type of the value contained in the collection type.
     * <p>i.e. the OF type.
     * <p>This could be a JDBC type, PLSQL type, or a PLSQL RECORD type.
     */
    public void setNestedType(DatabaseType nestedType) {
        this.nestedType = nestedType;
    }

    @Override
    public int getSqlCode() {
        return ARRAY;
    }
}