1 /*
2  * Copyright (c) 2008, 2019 Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v. 2.0 which is available at
6  * http://www.eclipse.org/legal/epl-2.0,
7  * or the Eclipse Distribution License v. 1.0 which is available at
8  * http://www.eclipse.org/org/documents/edl-v10.php.
9  *
10  * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
11  */

12
13 // Contributors:
14 //     Linda DeMichiel - 2.1
15 //     Linda DeMichiel - 2.0
16
17 package javax.persistence.metamodel;
18
19 /**
20  * Instances of the type <code>Bindable</code> represent object or attribute types 
21  * that can be bound into a {@link javax.persistence.criteria.Path Path}.
22  *
23  * @param <T>  The type of the represented object or attribute
24  *
25  * @since 2.0
26  *
27  */

28 public interface Bindable<T> {
29     
30     public static enum BindableType { 
31
32         /** Single-valued attribute type */
33         SINGULAR_ATTRIBUTE, 
34
35         /** Multi-valued attribute type */
36         PLURAL_ATTRIBUTE, 
37
38         /** Entity type */
39         ENTITY_TYPE
40     }
41
42     /**
43      *  Return the bindable type of the represented object.
44      *  @return bindable type
45      */
    
46     BindableType getBindableType();
47     
48     /**
49      * Return the Java type of the represented object.
50      * If the bindable type of the object is <code>PLURAL_ATTRIBUTE</code>,
51      * the Java element type is returned. If the bindable type is
52      * <code>SINGULAR_ATTRIBUTE</code> or <code>ENTITY_TYPE</code>, 
53      * the Java type of the
54      * represented entity or attribute is returned.
55      * @return Java type
56      */

57     Class<T> getBindableJavaType();
58 }
59