Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public Object decode(CachedData d) {
return rv;
}

@Override
public boolean isForceSerializeForCollection() {
return forceJDKSerializeForCollection;
}

public CachedData encode(Object o) {
byte[] b;
int flags = 0;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/spy/memcached/transcoders/Transcoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ public interface Transcoder<T> {
* Get the maximum size of objects handled by this transcoder.
*/
int getMaxSize();

/**
* Get if this transcoder forces serialization every type.
*/
default boolean isForceSerializeForCollection() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ protected void setUp() throws Exception {
tu = new TranscoderUtils(true);
}

@Test
void forceJDKSerializationReturnFalse() {
assertFalse(tc.isForceSerializeForCollection());
}

@Test
void testNonserializable() throws Exception {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ protected void tearDown() throws Exception {
super.tearDown();
}

@Test
void forceJDKSerializationReturnTrue() {
assertTrue(transcoder.isForceSerializeForCollection());
}

@Test
void decodeIntegerAsString() throws ExecutionException, InterruptedException {
// given
Expand Down