-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package upickle.core | ||
|
||
// Common things for derivation | ||
trait Config { | ||
@deprecated("Not used, left for binary compatibility") | ||
def tagName = Annotator.defaultTagKey | ||
|
||
/** | ||
* Whether or not `case class` fields with values equal to the default are serialized. | ||
* Defaults to `false`, so such fields are elided. | ||
*/ | ||
def serializeDefaults: Boolean = false | ||
|
||
/** | ||
* Map the name of Scala `case class` fields to JSON object fields during de-serialization. | ||
* Must be kept in sync with [[objectAttributeKeyWriteMap]] | ||
*/ | ||
def objectAttributeKeyReadMap(s: CharSequence): CharSequence = s | ||
|
||
/** | ||
* Map the name of JSON object fields to Scala `case class` fields during serialization. | ||
* Must be kept in sync with [[objectAttributeKeyReadMap]] | ||
*/ | ||
def objectAttributeKeyWriteMap(s: CharSequence): CharSequence = s | ||
|
||
/** | ||
* Map the name of JSON `$type` field values to Scala `case class` type names during | ||
* de-serialization. Must be kept in sync with [[objectTypeKeyWriteMap]] | ||
*/ | ||
def objectTypeKeyReadMap(s: CharSequence): CharSequence = s | ||
|
||
/** | ||
* Map the name of Scala `case class` type names to JSON `$type` field value during | ||
* serialization. Must be kept in sync with [[objectTypeKeyReadMap]] | ||
*/ | ||
def objectTypeKeyWriteMap(s: CharSequence): CharSequence = s | ||
|
||
/** | ||
* Whether top-level `Some(t)`s and `None`s are serialized unboxed as `t` or | ||
* `null`, rather than `[t]` or `[]`. This is generally what people expect, | ||
* although it does cause issues where `Some(null)` when serialized and de-serialized | ||
* can become `None`. Can be disabled to use the boxed serialization format | ||
* as 0-or-1-element-arrays, presering round trip-ability at the expense of | ||
* un-intuitiveness and verbosity | ||
*/ | ||
def optionsAsNulls: Boolean = true | ||
} |
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
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