diff options
Diffstat (limited to 'spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java')
-rw-r--r-- | spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java index f9375a9a..c3414e4d 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,27 +21,68 @@ package org.springframework.cache.interceptor; * * @author Costin Leau * @author Phillip Webb + * @author Marcin Kamionowski * @since 3.1 */ public class CacheableOperation extends CacheOperation { - private String unless; + private final String unless; + + private final boolean sync; + + + /** + * @since 4.3 + */ + public CacheableOperation(CacheableOperation.Builder b) { + super(b); + this.unless = b.unless; + this.sync = b.sync; + } public String getUnless() { - return unless; + return this.unless; } - public void setUnless(String unless) { - this.unless = unless; + public boolean isSync() { + return this.sync; } - @Override - protected StringBuilder getOperationDescription() { - StringBuilder sb = super.getOperationDescription(); - sb.append(" | unless='"); - sb.append(this.unless); - sb.append("'"); - return sb; + + /** + * @since 4.3 + */ + public static class Builder extends CacheOperation.Builder { + + private String unless; + + private boolean sync; + + public void setUnless(String unless) { + this.unless = unless; + } + + public void setSync(boolean sync) { + this.sync = sync; + } + + @Override + protected StringBuilder getOperationDescription() { + StringBuilder sb = super.getOperationDescription(); + sb.append(" | unless='"); + sb.append(this.unless); + sb.append("'"); + sb.append(" | sync='"); + sb.append(this.sync); + sb.append("'"); + return sb; + } + + @Override + public CacheableOperation build() { + return new CacheableOperation(this); + } } + } |