GithubHelp home page GithubHelp logo

vipcxj / beanknife Goto Github PK

View Code? Open in Web Editor NEW
163.0 6.0 7.0 848 KB

An annotation processor library to automatically generate the data transfer objects (DTO).

License: Apache License 2.0

Java 99.99% Batchfile 0.01%
dto annotation-processor json-view metadata data-transfer dto-bean spring-support

beanknife's People

Contributors

vipcxj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

beanknife's Issues

Configuration inheritance fails on rebuild with JDK 19

Issue:

The initial build works fine. However after changing a beanknife config class (adding a space is enough) and building again, two problems occur:

  1. For the edited config class, the inherited annotations are ignored in the build.
  2. The generated Meta class only contains the edited class.

Problem 1 occurs when building with JDK 19.0.2, but not with JDK 1.8.0_42
Problem 2 occurs with both SDKs

Steps to reproduce:

  • See https://github.com/marriesvdh/beanknife-inheritance-bug for a sample project
  • Build the project
    • The BeanView and BeanView2 classes are generated correctly (@ViewSetters(Access.PUBLIC) is inherited correctly, so BeanView contains a setter)
    • BeanMeta contains a reference to both views
  • Touch BeanViewConfig by adding a space
  • Build the project again (without clean)
    • The setter is not present anymore in the generated BeanView class.
    • The generated BeanMeta class only contains a reference to BeanView (and not BeanView2)

(After performing mvn clean, the first build is correct again)

Temporary workaround?

I assume the problem lies in the incremental compilation feature of Beanknife. Is it possible to disable this feature and rebuild all Beanknife classes everytime? As a temporary fix.

For now, cleaning before each build solves the issue.

static field cause generating class failed.

@Data
class Bean {
    private static final String serialVersionUID = 0L; // this static field is considered as a property by the library, it cause the generated file is illegal.
}

will generate

class BeanView {
   private String serialVersionUID;
   ...
   public BeanView read(Bean source) {
       BeanView out = new BeanView();
       ...
       out.serialVersionUID = source.getSerialVersionUID(); // This is illegal.
       ...
   }
   ...
}

@ViewPropertiesInclude and includes property of @ViewOf can not work together.

@Data
class Bean {
    private String a;
    private String b;
}

@ViewOf(value = Bean.class, includes = "a")
@ViewPropertiesInclude("b")
class BeanViewConfiguration {}

should generate

class BeanView {
    private String a;
    private String b;
}

but it generate

class BeanView {
    private String a;
}

It seems that includes property of @ViewOf override the @ViewPropertiesInclude.

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.