Home | History | Annotate | Download | only in sql
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package java.sql;
     19 
     20 /**
     21  * A class holding information about driver properties of a database connection.
     22  * This class is returned by the
     23  * {@link Driver#getPropertyInfo(String, java.util.Properties)} method and
     24  * allows for the advanced connection handling.
     25  */
     26 public class DriverPropertyInfo {
     27 
     28     /**
     29      * If the value member can be chosen from a set of possible values, they are
     30      * contained here. Otherwise choices is {@code null}.
     31      */
     32     public String[] choices;
     33 
     34     /**
     35      * A description of the property. May be {@code null}.
     36      */
     37     public String description;
     38 
     39     /**
     40      * The name of the property.
     41      */
     42     public String name;
     43 
     44     /**
     45      * {@code true} when the value member must be provided during {@code
     46      * Driver.connect}. {@code false} otherwise.
     47      */
     48     public boolean required;
     49 
     50     /**
     51      * The current value associated with this property. It is depending on the
     52      * data gathered by the {@code getPropertyInfo} method, the general Java
     53      * environment and the driver's default values.
     54      */
     55     public String value;
     56 
     57     /**
     58      * Creates a {@code DriverPropertyInfo} instance with the supplied name and
     59      * value. Other class members take their default values.
     60      *
     61      * @param name
     62      *            The property name.
     63      * @param value
     64      *            The property value.
     65      */
     66     public DriverPropertyInfo(String name, String value) {
     67         this.name = name;
     68         this.value = value;
     69         this.choices = null;
     70         this.description = null;
     71         this.required = false;
     72     }
     73 }
     74