DATAREDIS-593 - Use Enum.name() to represent enum values.
We now serialize Enum values using their name (Enum.name()) instead of using their string representation (Enum.toString()). toString can be customized in Enums to no longer report their name but a different value. A customized value cannot be used to reinstantiate the Enum value, only its name. This change affects serialization and will only affect new/updated values. Stored values with a customized toString representation still can't be deserialized until they were updated in Redis. Original Pull Request: #235
This commit is contained in:
committed by
Christoph Strobl
parent
78d6d1169e
commit
35bc928fc7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 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.
|
||||
@@ -28,8 +28,9 @@ import org.springframework.util.NumberUtils;
|
||||
|
||||
/**
|
||||
* Set of {@link ReadingConverter} and {@link WritingConverter} used to convert Objects into binary format.
|
||||
*
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 1.7
|
||||
*/
|
||||
final class BinaryConverters {
|
||||
@@ -108,6 +109,7 @@ final class BinaryConverters {
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 1.7
|
||||
*/
|
||||
@WritingConverter
|
||||
@@ -120,9 +122,8 @@ final class BinaryConverters {
|
||||
return new byte[] {};
|
||||
}
|
||||
|
||||
return fromString(source.toString());
|
||||
return fromString(source.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user