Skip to content

Commit c88ef07

Browse files
author
Mr14huashao
committed
Add setExtendedFieldNames() method and set config
1 parent f152a70 commit c88ef07

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/com/esotericsoftware/kryo/serializers/CompatibleFieldSerializer.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public CompatibleFieldSerializer (Kryo kryo, Class type, CompatibleFieldSerializ
6363

6464
@Override
6565
protected void initializeCachedFields() {
66-
if (!super.config.extendedFieldNames) {
66+
if (!config.extendedFieldNames) {
6767
final HashSet hashSet = new HashSet();
6868
CachedField[] fields = cachedFields.fields;
6969
for (int i = 0, n = fields.length; i < n; i++) {
@@ -304,6 +304,13 @@ public void setChunkedEncoding (boolean chunked) {
304304
if (TRACE) trace("kryo", "CompatibleFieldSerializerConfig setChunked: " + chunked);
305305
}
306306

307+
/** When true, field names are prefixed by their declaring class. This can avoid conflicts when a subclass has a field with
308+
* the same name as a super class. Default is false. */
309+
public void setExtendedFieldNames (boolean extendedFieldNames) {
310+
this.extendedFieldNames = extendedFieldNames;
311+
if (TRACE) trace("kryo", "CompatibleFieldSerializerConfig extendedFieldNames: " + extendedFieldNames);
312+
}
313+
307314
public boolean getChunkedEncoding () {
308315
return chunked;
309316
}

0 commit comments

Comments
 (0)