src/java.sql/share/classes/java/sql2/SqlStruct.java
branchJDK-8188051-branch
changeset 56380 f06946e00a26
parent 56373 1f76a5f8e999
child 56381 653b066f4a88
equal deleted inserted replaced
56373:1f76a5f8e999 56380:f06946e00a26
     1 /*
       
     2  * Copyright (c)  2017, 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 package java.sql2;
       
    26 
       
    27 import java.lang.annotation.Target;
       
    28 import static java.lang.annotation.ElementType.TYPE;
       
    29 import java.lang.annotation.Retention;
       
    30 import static java.lang.annotation.RetentionPolicy.RUNTIME;
       
    31 
       
    32 /**
       
    33  * Identifies a type that represents a STRUCT SQL type.
       
    34  */
       
    35 @Target({TYPE})
       
    36 @Retention(RUNTIME)
       
    37 public @interface SqlStruct {
       
    38   
       
    39   /**
       
    40    * The SQL name of the SQL STRUCT type.
       
    41    * 
       
    42    * @return the SQL identifier
       
    43    */
       
    44   public String sqlTypeName();
       
    45   
       
    46   /**
       
    47    * The fields of the SQL STRUCT type.
       
    48    * 
       
    49    * @return the fields
       
    50    */
       
    51   public Field[] fields();
       
    52   
       
    53   /**
       
    54    * Describes a field of a SQL STRUCT type.
       
    55    */
       
    56   public @interface Field {
       
    57     
       
    58     /**
       
    59      * The name of the field in the SQL STRUCT.
       
    60      * 
       
    61      * @return the name of the field
       
    62      */
       
    63     public String sqlFieldName();
       
    64     
       
    65     /**
       
    66      * The name of the SQL type of the field
       
    67      * 
       
    68      * @return the SQL type name of the field
       
    69      */
       
    70     public String sqlTypeName();
       
    71     
       
    72     /**
       
    73      * The Java identifier corresponding to the SQL field. This identifier is
       
    74      * used to determine the corresponding getter and setter for getting and
       
    75      * setting the value of this field in the annotated Java type.
       
    76      *
       
    77      * Implementations may choose to directly access a field named with the same
       
    78      * identifier or a constructor or static factory method where all of the
       
    79      * formal parameters are named by @Field annotations in the applied
       
    80      * @SqlStruct.
       
    81      *
       
    82      * @return a Java identifier
       
    83      */
       
    84     public String javaFieldName();
       
    85   }
       
    86 }