{"id":16422687,"url":"https://github.com/createsequence/powerful-annotation","last_synced_at":"2026-02-13T01:40:46.120Z","repository":{"id":47097154,"uuid":"515822483","full_name":"Createsequence/powerful-annotation","owner":"Createsequence","description":"一个小巧的、无依赖的 java 注解增强库","archived":false,"fork":false,"pushed_at":"2022-08-18T07:06:38.000Z","size":359,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-04-24T04:46:41.100Z","etag":null,"topics":["annotation","annotation-tool","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Createsequence.png","metadata":{"files":{"readme":"README-EN.md","changelog":null,"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":"2022-07-20T03:40:31.000Z","updated_at":"2024-12-21T05:52:58.000Z","dependencies_parsed_at":"2022-08-12T13:11:37.430Z","dependency_job_id":null,"html_url":"https://github.com/Createsequence/powerful-annotation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Createsequence/powerful-annotation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Createsequence%2Fpowerful-annotation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Createsequence%2Fpowerful-annotation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Createsequence%2Fpowerful-annotation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Createsequence%2Fpowerful-annotation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Createsequence","download_url":"https://codeload.github.com/Createsequence/powerful-annotation/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Createsequence%2Fpowerful-annotation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272936421,"owners_count":25018160,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","annotation-tool","java"],"created_at":"2024-10-11T07:37:23.809Z","updated_at":"2026-02-13T01:40:41.100Z","avatar_url":"https://github.com/Createsequence.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# powerful-annotation\n\n![qq群](https://img.shields.io/badge/qq%E7%BE%A4-540919540-yellowgreen)![CRANE](https://img.shields.io/github/license/Createsequence/crane) ![maven--central](https://img.shields.io/badge/maven--central-0.0.1-green)\n\n------\n\n[DOCUMENT_EN](README-EN.md)\n\n[中文文档](README.md)\n\n------\n\n## Introduction\n\n`powerful-annotation` is a compact and independent Java annotation enhancement library. It is used to solve some pain points in the use of Java annotations in daily development, and provides more powerful annotation search capabilities, more flexible and convenient repeatable annotations, and annotation synthesis mechanism similar to spring\n\nIts design inspiration comes from `spring-core`. In a non spring environment, `powerful-annotation` is a friendly alternative to spring annotation mechanism.\n\n## DOCUMENT\n\n[Wiki-CN](https://gitee.com/CreateSequence/powerful-annotation/wikis/Home)\n\n## FEATURES\n\n- No dependency：no other dependencies will be brought to the user's project；\n- Get started quickly：most functions can be used through static methods；\n- Powerful annotation search support：provide more powerful annotation search capabilities, and support searching annotations from complex hierarchical structures including class, method, attribute or meta annotation of annotations；\n- Better repeatable annotation support：provide more convenient ways to build or obtain repeatable annotations；\n- Annotation synthesis support：supports a spring like annotation synthesis mechanism, and can \"merge\" multiple related arbitrary annotations into a specific type of annotation according to a specific policy. The content of the annotation will achieve effects such as aliasing or mirroring according to the specified processing policy；\n\n## INSTALL\n\nIntroducing Maven dependency into XML files\n\n~~~xml\n\u003cdependency\u003e\n    \u003cgroupId\u003etop.xiajibagao\u003c/groupId\u003e\n    \u003cartifactId\u003epowerful-annotation\u003c/artifactId\u003e\n    \u003cversion\u003e${last-version}\u003c/version\u003e\n\u003c/dependency\u003e\n~~~\n\n## QUICK START\n\nAfter adding Maven dependency, we can use most of the functions by `top.xiajibagao.powerfulannotation.helper.Annotations`. Here are some basic examples:\n\n### 1.Search annotation\n\n\u003cimg src=\"https://img.xiajibagao.top/image-20220805152432933.png\" alt=\"image-20220805152432933\" style=\"zoom:50%;\" /\u003e\n\n~~~java\n// not search hierarchy, not search meta annotations\nAnnotations.getDirectAnnotation(Foo.class, Annotation1.class); // annotation1\nAnnotations.getAllDirectAnnotations(Foo.class, Annotation2.class); // []\nAnnotations.getAllDirectRepeatableAnnotations(Foo.class, Annotation1.class); // [annotation1]\nAnnotations.isDirectAnnotationPersent(Foo.class, Annotation2.class); // false\n\n// not search hierarchy, search meta annotations\nAnnotations.getIndirectAnnotation(Foo.class, Annotation2.class); // annotation2\nAnnotations.getAllIndirectAnnotations(Foo.class, Annotation2.class); // [annotation2]\nAnnotations.getAllIndirectRepeatableAnnotations(Foo.class, Annotation2.class); // [annotation2]\nAnnotations.isIndirectAnnotationPersent(Foo.class, Annotation2.class); // true\n\n// search hierarchy, not search meta annotations\nAnnotations.findDirectAnnotation(Foo.class, Annotation3.class); // annotation3\nAnnotations.findAllDirectAnnotations(Foo.class, Annotation2.class); // [annotation2]\nAnnotations.findAllDirectRepeatableAnnotations(Foo.class, Annotation3.class); // [annotation3]\nAnnotations.isDirectAnnotationFound(Foo.class, Annotation2.class); // true\n\n// search hierarchy, search meta annotations\nAnnotations.findIndirectAnnotation(Foo.class, Annotation3.class); // annotation3\nAnnotations.findAllIndirectAnnotations(Foo.class, Annotation2.class); // [annotation2, annotation2, annotation2]\nAnnotations.findAllIndirectRepeatableAnnotations(Foo.class, Annotation3.class); // [annotation3]\nAnnotations.isIndirectAnnotationFound(Foo.class, Annotation2.class); // true\n~~~\n\n### 2.Get repeatable annotation\n\n\u003cimg src=\"https://img.xiajibagao.top/image-20220805172946487.png\" alt=\"image-20220805172946487\" style=\"zoom: 50%;\" /\u003e\n\n~~~java\n// This function can be used with annotation search\nAnnotations.getAllDirectRepeatableAnnotations(Foo.class, Annotation1.class); // annotation1 * 7\nAnnotations.getAllDirectRepeatableAnnotations(Foo.class, Annotation2.class); // annotation2 * 3\nAnnotations.getAllDirectRepeatableAnnotations(Foo.class, Annotation3.class); // annotation1 * 1\n~~~\n\n### 3.Build repeatable annotation\n\nIn addition to supporting the JDK's annotation ` @Repeatable `, the above reusable annotation related APIs also support the extended annotation ` @Repeatable by `:\n\n~~~java\n// Use @Repeatableby to specify a container for repeatable annotations\n@RepeatableBy(annotation = Annotation2.class, attribute = \"annotations\")\nprivate @interface Annotation1 {\n    String value() default \"\";\n}\nprivate @interface Annotation2 {\n    Annotation1[] annotations() default {};\n}\n~~~\n\n该写法等同于：\n\n~~~java\n// Use @Repeatable to specify a container for repeatable annotations\n@Repeatable(Annotation2.class)\nprivate @interface Annotation1 {\n    String value() default \"\";\n}\nprivate @interface Annotation2 {\n    Annotation1[] values() default {};\n}\n~~~\n\nThis annotation supports mixed use with ` @Repeatable '.\n\n### 4.Synthesize annotation\n\nannotation synthesize use like `MergedAnnotation` of  spring. It supports \"merging\" between multiple annotations and the alias mechanism based on attribute annotation. This function can also be used in combination with annotation search.\n\n**Attribute mirroring**\n\n~~~java\nprivate @interface Annotation1 {\n    @MirrorFor(attribute = \"name\")\n    String value() default \"\";\n    @MirrorFor(attribute = \"value\")\n    String name() default \"\";\n}\n@Annotation1(\"foo\")\npublic class Foo {}\n\n// synthesize\nAnnotation1 annotation = Annotations.getSynthesizedAnnotation(Foo.class, Annotation1.class);\nannotation.name(); // \"foo\"\nannotation.value(); // \"foo\"\n~~~\n\n**Attribute aliasing**\n\n~~~java\nprivate @interface Annotation1 {\n    @AliasFor(attribute = \"name\")\n    String value() default \"\";\n    String name() default \"\";\n}\n@Annotation1(value = \"foo\", name = \"xxx\")\npublic class Foo {}\n\n// synthesize\nAnnotation1 annotation = Annotations.getSynthesizedAnnotation(Foo.class, Annotation1.class);\nannotation.name(); // \"foo\"\nannotation.value(); // \"foo\"\n~~~\n\n**Annotation synthesize**\n\n~~~java\n// meta annotation\nprivate @interface Annotation1 {\n    String name() default \"\";\n}\n// child annotation\n@Annotation1(\"default\")\nprivate @interface Annotation2 {\n    @AliasFor(annotation = Annotation1.class, attribute = \"name\")\n    String value() default \"\";\n}\n// child annotation only\n@Annotation2(\"foo\")\npublic class Foo {}\n\n// synthesize\nAnnotation1 annotation1 = Annotations.getSynthesizedAnnotation(Foo.class, Annotation1.class);\nannotation1.value(); // \"foo\"\nAnnotation2 annotation2 = Annotations.getSynthesizedAnnotation(Foo.class, Annotation2.class);\nannotation2.name(); // \"foo\"\n~~~\n\n## Contributing \u0026\u0026 Support\n\nIf you encounter problems, find bugs, or have any good ideas in use, welcome to issues or join QQ group: 540919540 feedback!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreatesequence%2Fpowerful-annotation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreatesequence%2Fpowerful-annotation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreatesequence%2Fpowerful-annotation/lists"}