{"id":18333109,"url":"https://github.com/zelr0x/jrealize","last_synced_at":"2025-07-07T17:34:09.309Z","repository":{"id":111701100,"uuid":"188732246","full_name":"zelr0x/jrealize","owner":"zelr0x","description":"Java annotation-based serializer","archived":false,"fork":false,"pushed_at":"2019-05-27T19:50:56.000Z","size":34,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T11:27:13.999Z","etag":null,"topics":["csv","java","serialization"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zelr0x.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-26T21:14:34.000Z","updated_at":"2019-05-30T14:31:12.000Z","dependencies_parsed_at":"2023-05-25T20:00:37.827Z","dependency_job_id":null,"html_url":"https://github.com/zelr0x/jrealize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zelr0x%2Fjrealize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zelr0x%2Fjrealize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zelr0x%2Fjrealize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zelr0x%2Fjrealize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zelr0x","download_url":"https://codeload.github.com/zelr0x/jrealize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248090567,"owners_count":21046112,"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":["csv","java","serialization"],"created_at":"2024-11-05T19:41:21.496Z","updated_at":"2025-04-09T18:43:44.898Z","avatar_url":"https://github.com/zelr0x.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jrealize\nJava annotation-based serializer\n##### Note: only CSV is supported for now\nCreated just for the sake of practicing with custom annotations and reflection\n\n\n## API\nAnnotate your class' fields that have to be serialized with appropriate format e.g. `@Csv`\n\n`int col()` annotation parameter has to be provided for CSV:\n```Java\n@Csv(col = 1)\nprivate String firstName;\n```\nIf the type of the field is primitive (e.g. `int`, `char`, etc.) or `String`, no further actions are needed. Other types may have inappropriate `toString()` implementations so there is one more step - implement a representation method with no parameters that returns String (like `toString()`) and annotate it with getter:\n```Java\n@CsvGetter\npublic String get() {\n    return value;\n}\n```\nIf you decide to override `toString()` and use it as a representation method, don't annotate any other method with getter - annotated getters have the highest priority. Annotating `toString()` itself is redundant as it is used as a fallback when no getter is provided. Only one annotated getter per class is allowed. Otherwise you'll get a RuntimeException with a message about multiple getters.\n```Java\n@CsvGetter // \u003c- redundant\n@Override\npublic String toString() {\n    return value;\n}\n```\n\nTo initiate a serialization process, call static methods like `Serializer.writeCsv()` with according parameters. For example, if `Employee` class has properly annotated fields, the following will write serialized version of the list `employees` into file `./csv/employees.csv`\n```Java\nfinal var employees = List.of(\n        new Employee(\"John\", \"Doe\", Position.RANK1, new PhoneNumber(\"01234567890\")),\n        new Employee(\"Jane\", \"Doe\", Position.RANK2, new PhoneNumber(\"09876543210\"))\n);\nfinal var dir = \"csv\";\nfinal var filename = \"employees.csv\";\nSerializer.writeCsv(employees, dir, filename);\n```\n\nDefault working directory is `\"user.dir\"` (the folder in which the program is ran). It can be overridden by creating an instance of Serializer and passing new folder as a parameter to its constructor. To initiate the serialization with an instance, call non-static methods like `serializerInstance.csv()`:\n```Java\nfinal var employees = List.of(\n        new Employee(\"John\", \"Doe\", Position.RANK1, new PhoneNumber(\"01234567890\")),\n        new Employee(\"Jane\", \"Doe\", Position.RANK2, new PhoneNumber(\"09876543210\"))\n);\nfinal var wd = \"csv\";\nfinal var serializer = new Serializer(wd);\nserializer.csv(employees, filename);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzelr0x%2Fjrealize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzelr0x%2Fjrealize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzelr0x%2Fjrealize/lists"}