1
1
/*
2
- * Copyright 2012-2020 the original author or authors
2
+ /*
3
+ * Copyright 2012-2021 the original author or authors
3
4
*
4
5
* Licensed under the Apache License, Version 2.0 (the "License");
5
6
* you may not use this file except in compliance with the License.
45
46
* @author Michael Nitschinger
46
47
* @author Michael Reiche
47
48
* @author Jorge Rodriguez Martin
49
+ * @author Carlos Espinaco
48
50
* @since 3.0
49
51
*/
50
- class CouchbaseTemplateSupport implements ApplicationContextAware {
52
+ class CouchbaseTemplateSupport implements ApplicationContextAware , TemplateSupport {
51
53
52
54
private static final Logger LOG = LoggerFactory .getLogger (CouchbaseTemplateSupport .class );
53
55
@@ -63,6 +65,7 @@ public CouchbaseTemplateSupport(final CouchbaseConverter converter, final Transl
63
65
this .translationService = translationService ;
64
66
}
65
67
68
+ @ Override
66
69
public CouchbaseDocument encodeEntity (final Object entityToEncode ) {
67
70
maybeEmitEvent (new BeforeConvertEvent <>(entityToEncode ));
68
71
Object maybeNewEntity = maybeCallBeforeConvert (entityToEncode , "" );
@@ -73,6 +76,7 @@ public CouchbaseDocument encodeEntity(final Object entityToEncode) {
73
76
return converted ;
74
77
}
75
78
79
+ @ Override
76
80
public <T > T decodeEntity (String id , String source , long cas , Class <T > entityClass ) {
77
81
final CouchbaseDocument converted = new CouchbaseDocument (id );
78
82
converted .setId (id );
@@ -90,6 +94,7 @@ public <T> T decodeEntity(String id, String source, long cas, Class<T> entityCla
90
94
return accessor .getBean ();
91
95
}
92
96
97
+ @ Override
93
98
public Object applyUpdatedCas (final Object entity , final long cas ) {
94
99
final ConvertingPropertyAccessor <Object > accessor = getPropertyAccessor (entity );
95
100
final CouchbasePersistentEntity <?> persistentEntity = mappingContext .getRequiredPersistentEntity (entity .getClass ());
@@ -102,6 +107,7 @@ public Object applyUpdatedCas(final Object entity, final long cas) {
102
107
return entity ;
103
108
}
104
109
110
+ @ Override
105
111
public Object applyUpdatedId (final Object entity , Object id ) {
106
112
final ConvertingPropertyAccessor <Object > accessor = getPropertyAccessor (entity );
107
113
final CouchbasePersistentEntity <?> persistentEntity = mappingContext .getRequiredPersistentEntity (entity .getClass ());
@@ -114,6 +120,7 @@ public Object applyUpdatedId(final Object entity, Object id) {
114
120
return entity ;
115
121
}
116
122
123
+ @ Override
117
124
public long getCas (final Object entity ) {
118
125
final ConvertingPropertyAccessor <Object > accessor = getPropertyAccessor (entity );
119
126
final CouchbasePersistentEntity <?> persistentEntity = mappingContext .getRequiredPersistentEntity (entity .getClass ());
@@ -129,6 +136,7 @@ public long getCas(final Object entity) {
129
136
return cas ;
130
137
}
131
138
139
+ @ Override
132
140
public String getJavaNameForEntity (final Class <?> clazz ) {
133
141
final CouchbasePersistentEntity <?> persistentEntity = mappingContext .getRequiredPersistentEntity (clazz );
134
142
MappingCouchbaseEntityInformation <?, Object > info = new MappingCouchbaseEntityInformation <>(persistentEntity );
0 commit comments