-
Notifications
You must be signed in to change notification settings - Fork 14
/
PluralQueryAttributeImpl.java
54 lines (42 loc) · 1.65 KB
/
PluralQueryAttributeImpl.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
package cz.cvut.kbss.jopa.model.metamodel;
import cz.cvut.kbss.jopa.model.annotations.FetchType;
import cz.cvut.kbss.jopa.model.annotations.ParticipationConstraint;
import cz.cvut.kbss.jopa.oom.converter.ConverterWrapper;
import cz.cvut.kbss.jopa.utils.CollectionFactory;
import java.lang.reflect.Field;
public class PluralQueryAttributeImpl<X, C, E> extends AbstractQueryAttribute<X, C>
implements PluralQueryAttribute<X, C, E> {
private final Type<E> elementType;
private final Class<C> collectionType;
public PluralQueryAttributeImpl(String query, Field field, ManagedType<X> declaringType, FetchType fetchType,
ParticipationConstraint[] constraints, Type<E> elementType,
Class<C> collectionType, ConverterWrapper converter) {
super(query, field, declaringType, fetchType, constraints, converter);
this.elementType = elementType;
this.collectionType = collectionType;
}
@Override
public boolean isCollection() {
return true;
}
@Override
public Class<E> getBindableJavaType() {
return elementType.getJavaType();
}
@Override
public cz.cvut.kbss.jopa.model.metamodel.Bindable.BindableType getBindableType() {
return BindableType.PLURAL_ATTRIBUTE;
}
@Override
public cz.cvut.kbss.jopa.model.metamodel.CollectionType getCollectionType() {
return CollectionFactory.resolveCollectionType(getJavaType());
}
@Override
public Type<E> getElementType() {
return elementType;
}
@Override
public Class<C> getJavaType() {
return collectionType;
}
}