This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new ef420e2671 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
ef420e2671 is described below
commit ef420e267143889e3263e433f4307d55ff3fab7c
Author: chaokunyang <[email protected]>
AuthorDate: Mon Aug 3 05:36:49 2026 +0000
🔄 synced local 'docs/guide/' with remote 'docs/guide/'
---
docs/guide/java/android-support.md | 3 ++-
docs/guide/java/graalvm-support.md | 7 ++++---
docs/guide/java/json-support.md | 14 ++++++++++++++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/docs/guide/java/android-support.md
b/docs/guide/java/android-support.md
index 0a90942f79..9a6ff8be32 100644
--- a/docs/guide/java/android-support.md
+++ b/docs/guide/java/android-support.md
@@ -162,7 +162,8 @@ annotations, and the Base64 codec constructor. Without
`@JsonType`, these annota
through reflection, but a release-minified application must keep the exact
annotated members,
annotation attributes, and codec constructor itself. A `JsonValue` method may
use a non-JavaBean
name, so its manual rule must name that method explicitly. `JsonFormat` keeps
the same direct-field
-and one-wrapper-level behavior as on the JVM.
+and one-wrapper-level behavior as on the JVM, including `timezone` for
`Instant`, `ZonedDateTime`,
+and `OffsetDateTime`.
Android Fory JSON requires a retained no-argument constructor for an ordinary
mutable class; it may
be non-public when Android reflection can make it accessible. `JsonCreator`
constructor-backed
diff --git a/docs/guide/java/graalvm-support.md
b/docs/guide/java/graalvm-support.md
index 824622f7a3..088ffed80e 100644
--- a/docs/guide/java/graalvm-support.md
+++ b/docs/guide/java/graalvm-support.md
@@ -163,9 +163,10 @@ JVM and Android.
`JsonValue` fields and effective public zero-argument methods are supported,
including matching
one-String `JsonCreator` constructors and public static factories. Fixed
`JsonRawValue` fields and
getters support trusted raw String values, and fixed `JsonBase64` fields and
getters support Base64
-`byte[]` values as on the JVM. `JsonFormat` date/time fields use the same
direct-field and
-one-wrapper-level behavior as on the JVM. For direct target annotations,
annotate each reachable
-owning model with `JsonType` so Native Image retains these members and the
Base64 codec constructor.
+`byte[]` values as on the JVM. `JsonFormat` date/time fields use the same
direct-field,
+one-wrapper-level, and `timezone` behavior as on the JVM. For direct target
annotations, annotate
+each reachable owning model with `JsonType` so Native Image retains these
members and the Base64
+codec constructor.
A directly annotated `JsonValue` Record uses its generated component accessor
and canonical
constructor operations. An effective declaration supplied by a Mixin uses the
Mixin workflow above
instead.
diff --git a/docs/guide/java/json-support.md b/docs/guide/java/json-support.md
index e26fe5c35f..2e5e8533c4 100644
--- a/docs/guide/java/json-support.md
+++ b/docs/guide/java/json-support.md
@@ -657,6 +657,7 @@ Use `JsonFormat` on a date/time field to select its JSON
text pattern in both di
use `DateTimeFormatter` syntax and the root locale:
```java
+import java.time.Instant;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@@ -675,6 +676,9 @@ public final class Schedule {
@JsonFormat(pattern = "dd/MM/uuuu")
public Map<String, LocalDate> daysByName;
+
+ @JsonFormat(pattern = "uuuu-MM-dd HH:mm:ss XXX", timezone = "Asia/Shanghai")
+ public Instant timestamp;
}
```
@@ -691,6 +695,16 @@ Supported values are exact `LocalDate`, `LocalTime`,
`LocalDateTime`, `Instant`,
offset carried by the value. The pattern must contain enough information to
reconstruct the
declared type.
+Set `timezone` to a valid `ZoneId` identifier to format and parse `Instant`,
`ZonedDateTime`, or
+`OffsetDateTime` in that zone. For example, the `timestamp` field above writes
+`Instant.parse("2024-01-02T03:04:05Z")` as `"2024-01-02 11:04:05 +08:00"`. The
parsed value keeps
+the same instant for matching timezone text. The configured zone supplies
missing zone or offset
+information during parsing; an explicit zone or offset in the JSON text
participates in the usual
+`DateTimeFormatter` resolution. Include an offset in the pattern when an exact
instant must survive
+a daylight saving time overlap. Omitting `timezone` preserves the default
behavior described
+above. Invalid zone identifiers and a non-empty `timezone` on other supported
date/time types are
+rejected.
+
`JsonFormat` is a field annotation, not a type-use annotation. A record
component works through its
generated field. Nested wrappers, Map keys, raw or wildcard direct children,
JSON Any values, and
unwrapped values are intentionally rejected. Types with ambiguous formatting
semantics, including
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]