|
31 | 31 | import org.slf4j.LoggerFactory;
|
32 | 32 | import org.springframework.core.annotation.AnnotatedElementUtils;
|
33 | 33 | import org.springframework.data.couchbase.core.mapping.CouchbaseDocument;
|
| 34 | +import org.springframework.data.couchbase.core.mapping.Document; |
| 35 | +import org.springframework.data.couchbase.core.mapping.Expiry; |
34 | 36 | import org.springframework.data.couchbase.repository.Collection;
|
35 | 37 | import org.springframework.data.couchbase.repository.ScanConsistency;
|
36 | 38 | import org.springframework.data.couchbase.repository.Scope;
|
|
56 | 58 | * Methods for building Options objects for Couchbae APIs.
|
57 | 59 | *
|
58 | 60 | * @author Michael Reiche
|
| 61 | + * @author Tigran Babloyan |
59 | 62 | */
|
60 | 63 | public class OptionsBuilder {
|
61 | 64 |
|
@@ -225,6 +228,30 @@ public static String getScopeFrom(Class<?> domainType) {
|
225 | 228 | }
|
226 | 229 | return null;
|
227 | 230 | }
|
| 231 | + |
| 232 | + public static DurabilityLevel getDurabilityLevel(Class<?> domainType) { |
| 233 | + if (domainType == null) { |
| 234 | + return null; |
| 235 | + } |
| 236 | + Document document = AnnotatedElementUtils.findMergedAnnotation(domainType, Document.class); |
| 237 | + return document.durabilityLevel(); |
| 238 | + } |
| 239 | + |
| 240 | + public static PersistTo getPersistTo(Class<?> domainType) { |
| 241 | + if (domainType == null) { |
| 242 | + return null; |
| 243 | + } |
| 244 | + Document document = AnnotatedElementUtils.findMergedAnnotation(domainType, Document.class); |
| 245 | + return document.persistTo(); |
| 246 | + } |
| 247 | + |
| 248 | + public static ReplicateTo getReplicateTo(Class<?> domainType) { |
| 249 | + if (domainType == null) { |
| 250 | + return null; |
| 251 | + } |
| 252 | + Document document = AnnotatedElementUtils.findMergedAnnotation(domainType, Document.class); |
| 253 | + return document.replicateTo(); |
| 254 | + } |
228 | 255 |
|
229 | 256 | /**
|
230 | 257 | * collection annotation
|
|
0 commit comments