Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

How to de/serialize an instance from/to Json/Yaml with dynamically typed attribute

Đang mở
#15 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
20/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
documentation

Hướng nghiên cứu

No repository files or tests are named. Start with the Java example in the issue and read the linked Stack Overflow and Baeldung references; document a reproducible answer covering serialization and deserialization of dynamically typed attributes in JSON or YAML.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

public class FlowExecutor {

    private String flowName;

    @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "className")
    private List<PreProcessor> preProcessors;

    @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "className")
    private List<PostProcessor> postAnalyzers;

}

public interface PreProcessor {
    void process(Request request, Context context);
}

YAMLFactory f = new YAMLFactory();
f.disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID);
ObjectMapper mapper = new ObjectMapper(f);
String config = mapper.writeValueAsString(executor);

see:
https://stackoverflow.com/questions/55008706/how-to-de-serialize-an-instance-with-dynamically-typed-attribute
https://www.baeldung.com/jackson-inheritance

Ngôn ngữ chính
Python
Star
5
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của davideuler/programming-tips

Tất cả issue của davideuler/programming-tips

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.