File: IMapping.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 (141 lines) | stat: -rw-r--r-- 4,678 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
 * Copyright (c) 2021 IBM Corporation. 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 - initial API and implementation
//
package org.eclipse.persistence.jpa.jpql.tools.spi;

import java.lang.annotation.Annotation;

/**
 * The external representation of a mapping, which represents a single persistence property
 * of a managed type.
 * <p>
 * Provisional API: This interface is part of an interim API that is still under development and
 * expected to change significantly before reaching stability. It is available at this early stage
 * to solicit feedback from pioneering adopters on the understanding that any code that uses this
 * API will almost certainly be broken (repeatedly) as the API evolves.
 *
 * @see IManagedType
 *
 * @version 2.4
 * @since 2.3
 * @author Pascal Filion
 */
public interface IMapping extends IExternalForm,
                                  Comparable<IMapping> {

    /**
     * Returns the type of this mapping.
     *
     * @return One of the supported mapping type, which is one of the constants defined in {@link
     * org.eclipse.persistence.jpa.jpql.tools.spi.IMappingType IMappingType} when the provider only
     * supports generic JPA
     */
    int getMappingType();

    /**
     * Returns the name of the persistence property represented by this mapping.
     *
     * @return The name of this mapping
     */
    String getName();

    /**
     * Returns the parent managed type owning this mapping.
     *
     * @return The parent of this mapping
     */
    IManagedType getParent();

    /**
     * Returns the type of this mapping. If this mapping is a relationship mapping, the parameter
     * type of the collection is returned.
     * <p>
     * <code>@OneToMany<br>private Collection&lt;Employee&gt; employees;</code>
     * <p>
     * "Employee" is the type. To retrieve {@link java.util.Collection}, {@link #getTypeDeclaration()}
     * needs to be used, its type will be {@link java.util.Collection} and it's generic type will be
     * <code>Employee</code>.
     *
     * @return The external form representing the type of this mapping
     */
    IType getType();

    /**
     * Returns the declaration of the Java class, which gives the information about type parameters,
     * dimensionality, etc.
     * <p>
     * <code>@OneToMany<br>private Collection&lt;Employee&gt; employees;</code>
     * <p>
     * "Collection&lt;Employee&gt;" is the type declaration.
     *
     * @return The external form of the class' type declaration
     */
    ITypeDeclaration getTypeDeclaration();

    /**
     * Determines whether the given annotation is present on this type.
     *
     * @param annotationType The class of the annotation
     * @return <code>true</code> if the annotation is defined on this type; <code>false</code>
     * otherwise
     */
    boolean hasAnnotation(Class<? extends Annotation> annotationType);

    /**
     * Determines whether this {@link IMapping} is a collection type mapping.
     *
     * @return <code>true</code> if this {@link IMapping} is a collection mapping;
     * <code>false</code> otherwise
     * @since 2.4
     */
    boolean isCollection();

    /**
     * Determines whether this {@link IMapping} is an embeddable type mapping.
     *
     * @return <code>true</code> if this {@link IMapping} is an embeddable mapping;
     * <code>false</code> otherwise
     * @since 2.4
     */
    boolean isEmbeddable();

    /**
     * Determines whether this {@link IMapping} is a property type mapping.
     *
     * @return <code>true</code> if this {@link IMapping} is a property mapping; <code>false</code>
     * otherwise
     * @since 2.4
     */
    boolean isProperty();

    /**
     * Determines whether this {@link IMapping} is a relationship type mapping.
     *
     * @return <code>true</code> if this {@link IMapping} is a relationship mapping;
     * <code>false</code> otherwise
     * @since 2.4
     */
    boolean isRelationship();

    /**
     * Determines whether this {@link IMapping} is a transient mapping.
     *
     * @return <code>true</code> if this {@link IMapping} is a transient mapping;
     * <code>false</code> otherwise
     * @since 2.4
     */
    boolean isTransient();
}