Code Monkey home page Code Monkey logo

Comments (5)

MisterChangRay avatar MisterChangRay commented on July 28, 2024 1

有个上百个字段的结构体,一个个写order有点费劲

  1. 显示声明可以避免随意字段顺序调整而造成的异常问题,通常显示申明更容易发现
  2. 最重要的一点,java 反射获取的字段是不保证顺序的,这一点在jdk文档中有说明。具体参阅:

from magic-byte.

MisterChangRay avatar MisterChangRay commented on July 28, 2024

有个上百个字段的结构体,一个个写order有点费劲

还有一点,一个结构体上百个字段是不是有点不合理。可以组合嵌套的,看起来似乎需要拆分一下。

from magic-byte.

hurui79 avatar hurui79 commented on July 28, 2024

有个上百个字段的结构体,一个个写order有点费劲

  1. 显示声明可以避免随意字段顺序调整而造成的异常问题,通常显示申明更容易发现

  2. 最重要的一点,java 反射获取的字段是不保证顺序的,这一点在jdk文档中有说明。具体参阅:

明白了。原来还有这种问题啊。
那javolution 是怎么解决排序问题的,他的用法好像就不需要order排序属性,不过他的自定义类型用着很恶心。

from magic-byte.

hurui79 avatar hurui79 commented on July 28, 2024

有个上百个字段的结构体,一个个写order有点费劲

还有一点,一个结构体上百个字段是不是有点不合理。可以组合嵌套的,看起来似乎需要拆分一下。

这个可不由我决定,edgetech的jsf官方文档就是这样,他的头信息比较多没法嵌套。

from magic-byte.

MisterChangRay avatar MisterChangRay commented on July 28, 2024

有个上百个字段的结构体,一个个写order有点费劲

还有一点,一个结构体上百个字段是不是有点不合理。可以组合嵌套的,看起来似乎需要拆分一下。

这个可不由我决定,edgetech的jsf官方文档就是这样,他的头信息比较多没法嵌套。

嗯嗯,处理出来就好

from magic-byte.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.