/
CollectionIndex.java
58 lines (45 loc) · 1.46 KB
/
CollectionIndex.java
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
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel.model.domain.spi;
import java.util.List;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.metamodel.model.relational.spi.Column;
import org.hibernate.sql.ast.produce.spi.TableReferenceContributor;
/**
* @author Steve Ebersole
*/
public interface CollectionIndex<J> extends Navigable<J>, TableReferenceContributor {
String NAVIGABLE_NAME = "{index}";
SimpleTypeDescriptor<?> getDomainTypeDescriptor();
enum IndexClassification {
BASIC,
EMBEDDABLE,
ANY,
ONE_TO_MANY,
MANY_TO_MANY
}
IndexClassification getClassification();
List<Column> getColumns();
default boolean canContainSubGraphs() {
final IndexClassification classification = getClassification();
return classification == IndexClassification.BASIC || classification == IndexClassification.ANY;
}
boolean hasNotNullColumns();
boolean isSettable();
int getBaseIndex();
// todo (6.0) - should this be moved into a super contract?
default J replace(J originalValue, J targetValue, Object owner, Map copyCache, SessionImplementor session) {
return getJavaTypeDescriptor().getMutabilityPlan().replace(
originalValue,
targetValue,
owner,
copyCache,
session
);
}
}