1 /*
2  * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package java.sql;
27 
28 /**
29  * <p>Driver properties for making a connection. The
30  * {@code DriverPropertyInfo} class is of interest only to advanced programmers
31  * who need to interact with a Driver via the method
32  * {@code getDriverProperties} to discover
33  * and supply properties for connections.
34  *
35  * @since 1.1
36  */
37 
38 public class DriverPropertyInfo {
39 
40     /**
41      * Constructs a {@code DriverPropertyInfo} object with a  given
42      * name and value.  The {@code description} and {@code choices}
43      * are initialized to {@code null} and {@code required} is initialized
44      * to {@code false}.
45      *
46      * @param name the name of the property
47      * @param value the current value, which may be null
48      */
DriverPropertyInfo(String name, String value)49     public DriverPropertyInfo(String name, String value) {
50         this.name = name;
51         this.value = value;
52     }
53 
54     /**
55      * The name of the property.
56      */
57     public String name;
58 
59     /**
60      * A brief description of the property, which may be null.
61      */
62     public String description = null;
63 
64     /**
65      * The {@code required} field is {@code true} if a value must be
66          * supplied for this property
67      * during {@code Driver.connect} and {@code false} otherwise.
68      */
69     public boolean required = false;
70 
71     /**
72      * The {@code value} field specifies the current value of
73          * the property, based on a combination of the information
74          * supplied to the method {@code getPropertyInfo}, the
75      * Java environment, and the driver-supplied default values.  This field
76      * may be null if no value is known.
77      */
78     public String value = null;
79 
80     /**
81      * An array of possible values if the value for the field
82          * {@code DriverPropertyInfo.value} may be selected
83          * from a particular set of values; otherwise null.
84      */
85     public String[] choices = null;
86 }
87