Code Monkey home page Code Monkey logo

Comments (4)

MisterChangRay avatar MisterChangRay commented on July 28, 2024

这里这个如果要支持表达式那就要引入ognl包,感觉为了这个不值得引入另一个包。

所以我想的是有两种方案:

  • 设置一个属性,可以将类的order设置为全局,这样就可以取到了
  • 可以为每类设置一个基准order值,这样也可以访问到其他bean的属性

from magic-byte.

FULaBUla avatar FULaBUla commented on July 28, 2024

确实,SPEL、OGNL、Groovy、JEXL、EL 这几种实现都需要引依赖。

我更倾向于第二种,感觉第一种会导致使用上混乱或者不灵活,不能配置多个。第二个的话,是不是这样实现,

@MagicClass
class A {

@MagicField(order = 1)
private int a;

@MagicField(order = 3)
private int length;

}

@MagicClass
class B {

@MagicField(order = 1)
private A a;

// 样式 1
@MagicField(order = 3, dynamicSizeof = 3, sizeFather = 1)
private byte[] data;

// 样式 2
@MagicField(order = 3, dynamicSizeof = 1.3)
private byte[] data;

}

from magic-byte.

MisterChangRay avatar MisterChangRay commented on July 28, 2024

现在已经实现并支持了。

废弃当前以orderrid作为引用,替换为以属性名为引用(支持相对引用和绝对引用)

可以直接以属性名引用当前同级或者下级所有属性,也支持以绝对引用(以根对象开始引用属性路径)

from magic-byte.

FULaBUla avatar FULaBUla commented on July 28, 2024

现在已经实现并支持了。

废弃当前以orderrid作为引用,替换为以属性名为引用(支持相对引用和绝对引用)

可以直接以属性名引用当前同级或者下级所有属性,也支持以绝对引用(以根对象开始引用属性路径)

旧的和新的使用方式是不是都存在比较好,否则这个对于已实现但想用新版本特性的代码改动量太大了吧

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.