-
Notifications
You must be signed in to change notification settings - Fork 199
/
CreateAssociationWithKeyImpl.java
49 lines (40 loc) · 1.36 KB
/
CreateAssociationWithKeyImpl.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
/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* 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.ogm.compensation.operation.impl;
import org.hibernate.ogm.compensation.operation.CreateAssociationWithKey;
import org.hibernate.ogm.compensation.operation.GridDialectOperation;
import org.hibernate.ogm.compensation.operation.OperationType;
import org.hibernate.ogm.model.key.spi.AssociationKey;
/**
* @author Gunnar Morling
*
*/
public class CreateAssociationWithKeyImpl implements CreateAssociationWithKey {
private final AssociationKey associationKey;
public CreateAssociationWithKeyImpl(AssociationKey associationKey) {
this.associationKey = associationKey;
}
@Override
public AssociationKey getAssociationKey() {
return associationKey;
}
@Override
public <T extends GridDialectOperation> T as(Class<T> type) {
if ( CreateAssociationWithKey.class.isAssignableFrom( type ) ) {
return type.cast( this );
}
throw new IllegalArgumentException( "Unexpected type: " + type );
}
@Override
public OperationType getType() {
return OperationType.CREATE_ASSOCIATION_WITH_KEY;
}
@Override
public String toString() {
return "CreateAssociationImpl [associationKey=" + associationKey + "]";
}
}