forked from EsotericSoftware/kryo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a possibility to set a custom InstantiationStrategy. The Kryo.Def…
…aultInstantiatorStrategy implements the usual Kryo behavior, where it tries to invoke a no-arg constructor when it needs to create a new instance. But when org.objenesis.strategy.StdInstantiatorStrategy is used, then new instances are created without invoking a no-arg constructor, even if such a constructor is available. This improves Kryo's performance on fast-serialization tests (see issue EsotericSoftware#138)
- Loading branch information
Showing
3 changed files
with
122 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** Reads and writes objects to and from bytes. | ||
* @author Nathan Sweet <[email protected]> */ | ||
public abstract class Serializer<T> { | ||
private boolean acceptsNull, immutable; | ||
private boolean acceptsNull, immutable, defaultSerializer; | ||
|
||
public Serializer () { | ||
} | ||
|
@@ -64,6 +64,16 @@ public boolean isImmutable () { | |
public void setImmutable (boolean immutable) { | ||
this.immutable = immutable; | ||
} | ||
|
||
|
||
public boolean isDefaultSerializer () { | ||
return defaultSerializer; | ||
} | ||
|
||
/** If true, this is a default serializer */ | ||
public void setDefaultSerializer (boolean defaultSerializer) { | ||
this.defaultSerializer = defaultSerializer; | ||
} | ||
|
||
/** Sets the generic types of the field or method this serializer will be used for on the next call to read or write. Subsequent | ||
* calls to read and write must not use this generic type information. The default implementation does nothing. Subclasses may | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters