Comments (5)
Thanks for the bug report and patch.
I'm going to apply this patch to trunk before releasing next version (2.0.0).
Original comment by [email protected]
on 9 Jan 2012 at 11:15
- Changed state: Accepted
from simple-spring-memcached.
Unfortunately attached patch will work only with bridge methods having the same
amount and order of parameters as defined in @GenericsBridged annotation and
with proper type of parameters.
Example:
{code}
public interface Generic<K,V> {
// amount and order of parameters and is the same as in @GenericsBridged and types of parameters are appropriate
void set(K key, V value);
// wrong, method has different amount of parameters than @GenericsBridged
V get(K key);
// wrong, method has different amount of parameters than @GenericsBridged
void put(K key, V value, boolean overwrite);
}
public interface Specific extends Generic<String, Integer> {}
//@GenericsBridged(classes={String.class, Integer.class})
public class SpecificImpl implements Specific {
@BridgeMethodParams({String.class, Integer.class})
public void set(String key, Integer value) {
....
}
@BridgeMethodParams({String.class})
public Integer get(String key) {
.....
}
@BridgeMethodParams({String.class, Integer.class, boolean.class})
public void put(String key, Integer value, boolean overwrite) {
....
}
}
{code}
One of the fix that I see is to use annotation on method. Dedicated annotation
@BridgeMethodParams contains types of annotated method's parameters in
appropriate order. The downside is that in same cases developer will have to
put many @BridgeMethodParams in his class.
Original comment by [email protected]
on 11 Jan 2012 at 6:54
from simple-spring-memcached.
I agree with your idea to use annotation on method (even considering the
downside). In this manner the code can work also in the situation that you
explained.
Original comment by [email protected]
on 11 Jan 2012 at 8:54
from simple-spring-memcached.
This approach with @BridgeMethodParams doesn't work. If it worked it wouldn't
be necessary because fetching directly @*Cache annotation would work also. The
only solution that I see is to use type annotation with some mappings for each
bridged method.
@BridgeMethodMappings({
@BridgeMethodMapping(name = "set", erasedParamTypes = {Object.class,
Object.class}, targetParamTypes = {String.class, Integer.class}),
@BridgeMethodMapping(name = "get", erasedParamTypes = {Object.class},
targetParamTypes = {String.class}),
@BridgeMethodMapping(name = "put", erasedParamTypes = {Object.class,
Object.class, boolean.class}, targetParamTypes = {String.class, Integer.class,
boolean.class})
)}
public class SpecificImpl implements Specific {
.....
}
This requires many additional annotations and knowledge about java type erasure.
Original comment by [email protected]
on 11 Jan 2012 at 7:31
from simple-spring-memcached.
Code in trunk.
Original comment by [email protected]
on 31 Jan 2012 at 8:53
- Changed state: Fixed
from simple-spring-memcached.
Related Issues (20)
- The cache with name or alias 'default' is no defined HOT 7
- more fexibility with CacheKeyMethod and key generation HOT 9
- Using @ReturnValueKeyProvider for an @UpdateSingleCache annotated method does not generate key properly HOT 5
- Clear multiple keys HOT 2
- Maven provided dependencies. HOT 4
- add connect timeout from CacheClientFactory HOT 4
- Guice support HOT 4
- ReadThroughMultiCache returns incomplete results if memcached client times out HOT 8
- spring-cache cacheAlias(cache zone) support. HOT 8
- IncompatibleClassChangeError: Implementing class under Jetty 7.6.8.v20121106 HOT 2
- Unsorted results when using ReadThroughMultiCacheAdvice HOT 13
- Support server weights for XMemcachedClientBuilder HOT 3
- Java based configuration HOT 5
- CacheValueMethod HOT 3
- SerializationType.CUSTOM problems HOT 4
- Update jackson to latest HOT 12
- Serializers are not called HOT 16
- MetricCollector support for Spymemcached HOT 7
- aspectjrt jar conflict HOT 6
- 启动报错 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-spring-memcached.