{"id":21832747,"url":"https://github.com/liying2008/pojo-derivation","last_synced_at":"2025-03-21T13:43:51.630Z","repository":{"id":57715463,"uuid":"166634897","full_name":"liying2008/pojo-derivation","owner":"liying2008","description":"Combine multiple POJOs to generate a new POJO.","archived":false,"fork":false,"pushed_at":"2023-01-07T10:45:18.000Z","size":346,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-26T09:27:42.419Z","etag":null,"topics":["annotation-processor","annotations","apt","derivation","java-library","kapt","kotlin","library","pojo","pojo-derivation","pojos"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liying2008.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-20T07:30:02.000Z","updated_at":"2023-01-06T14:50:48.000Z","dependencies_parsed_at":"2023-02-06T23:02:02.669Z","dependency_job_id":null,"html_url":"https://github.com/liying2008/pojo-derivation","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liying2008%2Fpojo-derivation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liying2008%2Fpojo-derivation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liying2008%2Fpojo-derivation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liying2008%2Fpojo-derivation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liying2008","download_url":"https://codeload.github.com/liying2008/pojo-derivation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244807282,"owners_count":20513608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation-processor","annotations","apt","derivation","java-library","kapt","kotlin","library","pojo","pojo-derivation","pojos"],"created_at":"2024-11-27T19:25:19.934Z","updated_at":"2025-03-21T13:43:51.606Z","avatar_url":"https://github.com/liying2008.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pojo-derivation\n\n[![maven-central](https://img.shields.io/maven-central/v/cc.duduhuo.util/pojo-derivation-annotations.svg?style=flat)](https://mvnrepository.com/artifact/cc.duduhuo.util/pojo-derivation-annotations)\n[![license](https://img.shields.io/github/license/liying2008/pojo-derivation.svg?style=flat)](https://github.com/liying2008/pojo-derivation/blob/master/LICENSE)\n\nCombine multiple POJOs to generate a new POJO.\n\n## 1 Setup\n\n+ Kotlin Project\n\n```gradle\napply plugin: 'kotlin-kapt'\n\ndependencies {\n    compileOnly('cc.duduhuo.util:pojo-derivation-annotations:1.2.0')\n    kapt('cc.duduhuo.util:pojo-derivation-compiler:1.2.0')\n}\n```\n\n+ Pure Java Project\n\n```gradle\ndependencies {\n    compileOnly('cc.duduhuo.util:pojo-derivation-annotations:1.2.0')\n    annotationProcessor('cc.duduhuo.util:pojo-derivation-compiler:1.2.0')\n}\n```\n\n## 2 Use\n\nYou can use the `Derivation` annotation on any class:\n\n```java\n@Derivation(\n        name = \"ABC\",\n        sourceTypes = {A.class, B.class, C.class},\n        constructorTypes = {ConstructorType.NO_ARGS, ConstructorType.ALL_ARGS, ConstructorType.ALL_SOURCE_OBJS}\n)\nfinal class ABCCombine {}\n```\n\nThen you will get a new class as shown below:\n\n```java\n// This file is automatically generated by pojo-derivation (https://github.com/liying2008/pojo-derivation).\n// Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n// File generation time: Sat Feb 13 17:45:10 CST 2021\npackage cc.duduhuo.util.pojo.derivation.samplebase.readme;\n\nimport java.lang.String;\nimport org.jetbrains.annotations.NotNull;\n\n/**\n * Generated according to {@link cc.duduhuo.util.pojo.derivation.samplebase.readme.ABCCombine}.\n */\npublic class ABC {\n    private int a1;\n\n    private String a2;\n\n    private boolean b1;\n\n    private double b2;\n\n    private boolean c1;\n\n    private char c2;\n\n    @NotNull\n    private String c3;\n\n    public ABC() {\n    }\n\n    public ABC(int a1, String a2, boolean b1, double b2, boolean c1, char c2, String c3) {\n        this.a1 = a1;\n        this.a2 = a2;\n        this.b1 = b1;\n        this.b2 = b2;\n        this.c1 = c1;\n        this.c2 = c2;\n        this.c3 = c3;\n    }\n\n    public ABC(A a, B b, C c) {\n        this.setA1(a.getA1());\n        this.setA2(a.getA2());\n        this.setB1(b.isB1());\n        this.setB2(b.getB2());\n        this.setC1(c.getC1());\n        this.setC2(c.getC2());\n        this.setC3(c.getC3());\n    }\n\n    public int getA1() {\n        return a1;\n    }\n\n    public void setA1(int a1) {\n        this.a1 = a1;\n    }\n\n    public String getA2() {\n        return a2;\n    }\n\n    public void setA2(String a2) {\n        this.a2 = a2;\n    }\n\n    public boolean isB1() {\n        return b1;\n    }\n\n    public void setB1(boolean b1) {\n        this.b1 = b1;\n    }\n\n    public double getB2() {\n        return b2;\n    }\n\n    public void setB2(double b2) {\n        this.b2 = b2;\n    }\n\n    public boolean isC1() {\n        return c1;\n    }\n\n    public void setC1(boolean c1) {\n        this.c1 = c1;\n    }\n\n    public char getC2() {\n        return c2;\n    }\n\n    public void setC2(char c2) {\n        this.c2 = c2;\n    }\n\n    public String getC3() {\n        return c3;\n    }\n\n    public void setC3(String c3) {\n        this.c3 = c3;\n    }\n}\n```\n\nSee `sample` module for more examples.\n\n## 3 License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliying2008%2Fpojo-derivation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliying2008%2Fpojo-derivation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliying2008%2Fpojo-derivation/lists"}