{"id":20773213,"url":"https://github.com/moyada/medivh","last_synced_at":"2026-06-07T14:31:16.861Z","repository":{"id":57734259,"uuid":"162589466","full_name":"moyada/medivh","owner":"moyada","description":"A method parameter validation generator for Java.","archived":false,"fork":false,"pushed_at":"2019-01-25T03:24:31.000Z","size":332,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T07:31:31.437Z","etag":null,"topics":["abstract-syntax-tree","bean-validation","checker-library","java-annotation-processor","java-processor","jsr-380"],"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/moyada.png","metadata":{"files":{"readme":"README.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":"2018-12-20T14:21:17.000Z","updated_at":"2023-01-11T08:47:24.000Z","dependencies_parsed_at":"2022-09-26T22:10:56.473Z","dependency_job_id":null,"html_url":"https://github.com/moyada/medivh","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moyada%2Fmedivh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moyada%2Fmedivh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moyada%2Fmedivh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moyada%2Fmedivh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moyada","download_url":"https://codeload.github.com/moyada/medivh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243112185,"owners_count":20238180,"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":["abstract-syntax-tree","bean-validation","checker-library","java-annotation-processor","java-processor","jsr-380"],"created_at":"2024-11-17T12:24:54.968Z","updated_at":"2025-12-16T12:56:22.451Z","avatar_url":"https://github.com/moyada.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Medivh\n\n[![Build Status](https://travis-ci.org/moyada/medivh.svg?branch=master)](https://travis-ci.org/moyada/medivh)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.moyada/medivh/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.moyada/medivh)\n[![license](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/moyada/medivh/blob/master/LICENSE)\n\n\u003e A simple, automatic, and flexible method parameter check library for the Java platform.\n\n## Documentation\n\n* [Getting Started](https://moyada.github.io/medivh/)\n\n## Motivation\n\nWe often need to check the method parameters, especially in remote invocation.\nThis library can save time and effort in this respect, modify the syntax tree at `compilation phase` by configure annotations, and add parameter validation to method.\n\n## Features\n\n* Check whether an object is null.\n\n* Check the size range of basic numeric type (such as int and Integer).\n\n* Check whether a string is blank.\n\n* Check the length range of String or array.\n\n* Check the capacity range of Collection or Map.\n\n* Throw an exception or return data when validated is fails.\n\n## Preview\n\n```\npublic class MyApp {\n\n    @Throw\n    public Boolean run(Args args,\n                    @Return(\"null\") @NotBlank String name,\n                    @Return(\"false\") @Min(1) int num) {\n        System.out.println(\"process\");\n        return true;\n    }\n\n    class Args {\n\n        @Max(1000) int id;\n\n        @NotBlank String name;\n\n        @Nullable @DecimalMin(-25.02) @DecimalMax(200) Double price;\n\n        @Size(min = 10, max = 10) String[] values;\n\n        @NotNull HashMap\u003cString, Object\u003e param;\n\n        @Size(max = 5) List\u003cString\u003e extra;\n    }\n}\n```\n\nAfter compilation, the program will be this.\n\n```\npublic class MyApp {\n    public MyApp() {\n    }\n\n    public Boolean run(MyApp.Args args, String name, int num) {\n        if (args == null) {\n            throw new IllegalArgumentException(\"Invalid input parameter, cause args is null\");\n        } else {\n            String mvar_0 = args.invalid0();\n            if (mvar_0 != null) {\n                throw new IllegalArgumentException(\"Invalid input parameter, cause \" + mvar_0);\n            } else if (name == null) {\n                return null;\n            } else if (isBlank(name)) {\n                return null;\n            } else if (num \u003c 1) {\n                return false;\n            } else {\n                System.out.println(\"process\");\n                return true;\n            }\n        }\n    }\n\n    class Args {\n        int id;\n        String name;\n        Double price;\n        String[] values;\n        HashMap\u003cString, Object\u003e param;\n        List\u003cString\u003e extra;\n\n        Args() {\n        }\n\n        public String invalid0() {\n            if (this.id \u003e 1000) {\n                return \"id great than 1000\";\n            } else if (this.values == null) {\n                return \"values is null\";\n            } else if (this.values.length != 10) {\n                return \"values cannot equals 10\";\n            } else if (this.param == null) {\n                return \"param is null\";\n            } else {\n                if (this.price != null) {\n                    if (this.price \u003e 200.0D) {\n                        return \"price great than 200.0\";\n                    }\n\n                    if (this.price \u003c -25.02D) {\n                        return \"price less than -25.02\";\n                    }\n                }\n\n                if (this.name == null) {\n                    return \"name is null\";\n                } else if (isBlank(this.name)) {\n                    return \"name is blank\";\n                } else if (this.extra == null) {\n                    return \"extra is null\";\n                } else {\n                    return this.extra.size() \u003e 5 ? \"extra.size() great than 5\" : null;\n                }\n            }\n        }\n    }\n    \n    public static boolean isBlank(String str) {\n        int length = str.length();\n        if (length == 0) {\n            return true;\n        } else {\n            for(int i = 0; i \u003c length; ++i) {\n                char ch = str.charAt(i);\n                if (ch != ' ') {\n                    return false;\n                }\n            }\n    \n            return true;\n        }\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoyada%2Fmedivh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoyada%2Fmedivh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoyada%2Fmedivh/lists"}