#1214: JsonThreadLocalContext.kt
projectforge-business/src/main/kotlin/org/projectforge/framework/json/JsonThreadLocalContext.kt Thread-Local Context, projectforge-business/src/main/kotlin/org/projectforge/framework/json/JsonThreadLocalContext.kt 54 lines · 23 code · 26 comments · 5 blank
Thread-local context controlling JSON serialization behavior of IdOnlySerializer. Provides two boolean flags: preferEmbeddedSerializers (use full serialization if available) and ignoreIdOnlySerializers (use Jackson default). Managed via static set(), get(), clear() on a ThreadLocal.
Architecture
Flags
| Flag | Default | Effect on IdOnlySerializer |
preferEmbeddedSerializers | false | If true, tries to find another registered Jackson serializer for the entity class |
ignoreIdOnlySerializers | false | If true, uses Jackson's default object serialization |
Usage Pattern
JsonThreadLocalContext.set(preferEmbeddedSerializers = true)
try {
JsonUtils.toJson(someEntity) // will fully serialize
} finally {
JsonThreadLocalContext.clear()
}
Git History
868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
59519ee50 Json serialization refactored: IdOnlySerializer and IdsOnlySerializer introduced.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022
ceb63e8a1 Source code header: (C) 2001-2021.
b209e00ba PFDay.from -> from, fromOrNow, fromOrNull, PFDateTime.from -> from, fromOrNow, fromOrNull
7fdd07b74 Vacations: Leave days over years (new year) supported.
cccd16ed8 LocalDatePeriod helper class added.
7c79f1922 Copyright of source header -> 2020.
dd5ca38ac CopyRight of all java file-header updated or created.
2d86a8cd6 PROJECTFORGE-2306 Refactorings for keeping access check at update time
9ebb88522 Initial commit