{"id":22646016,"url":"https://github.com/qzagarese/hyaline-dto","last_synced_at":"2026-03-14T09:34:07.064Z","repository":{"id":24856436,"uuid":"28271689","full_name":"qzagarese/hyaline-dto","owner":"qzagarese","description":"A Java library for Dynamically Typed Objects","archived":false,"fork":false,"pushed_at":"2016-02-12T14:18:37.000Z","size":100,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T20:21:23.467Z","etag":null,"topics":[],"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/qzagarese.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-20T16:09:11.000Z","updated_at":"2024-08-31T08:09:04.000Z","dependencies_parsed_at":"2022-08-23T07:51:06.987Z","dependency_job_id":null,"html_url":"https://github.com/qzagarese/hyaline-dto","commit_stats":null,"previous_names":["bluesoul/hyaline-dto"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qzagarese%2Fhyaline-dto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qzagarese%2Fhyaline-dto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qzagarese%2Fhyaline-dto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qzagarese%2Fhyaline-dto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qzagarese","download_url":"https://codeload.github.com/qzagarese/hyaline-dto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501700,"owners_count":21114676,"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":[],"created_at":"2024-12-09T06:08:14.539Z","updated_at":"2026-03-14T09:34:07.015Z","avatar_url":"https://github.com/qzagarese.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hyaline DTO - A Java library for Dynamically Typed Objects \n=====================\n\nHyaline is a simple library for creating ~~Data Transfer Objects (DTO)~~ Dynamically Typed Objects in a single instruction.\nLet's say you have a REST service and you want to return a specific JSON object without having to create a new type for that.\nWith Hyaline (+Spring) you can just write something like this:\n\n```java\n@RequestMapping(\"/myJSON\")\npublic Object myJSON() throws HyalineException {\n\treturn Hyaline.dtoFromScratch(new DTO(){\n\t\tString what = \"The JSON I want.\";\n\t\tString how = \"Without creating a new class!\";\n\t\tString when = \"Now!!!! -\u003e \" + new Date();\n\t});\n}\n```\nand you get something like this: \n\n```javascript\n{\n  \"what\":\"The JSON I want.\",\n  \"how\":\"Without creating a new class!\",\n  \"when\":\"Now!!!! -\u003e Sun Apr 19 14:50:41 BST 2015\"\n}\n```\nWell, pretty useless, but it basically shows that you can prototype your objects by putting whatever you need inside and get exactly what you expect.\n\n####Use it with any annotation-based framework\nHyaline handles annotations, which means you can use it with most of the frameworks you like.\nIf, for instance, I want to rename one of the fields above in a quite dumb way, I might not rename the variable, but I could use a Jackson annotation:  \n\n```java\nreturn Hyaline.dtoFromScratch(new DTO(){\n\tString what = \"The JSON I want.\";\n\tString how = \"Without creating a new class!\";\n\t@JsonProperty(\"deadline\")\n\tString when = \"Now!!!! -\u003e \" + new Date();\n});\n```\n\n###One more thing \nHyaline works pretty well when it comes to create DTOs, but it is basically a tool that accepts stuff with annotations and spits out new types, so you can imagine a lot of possible scenarios (what about dynamic pojo validation or dynamic persistence mappings?). Imagination is the limit :-) \n\n##Where to go from here?\n\nThe [Getting started](https://github.com/Bluesoul/hyaline-dto/wiki/Getting-started) page is probably the best place :-)\nYou can also give a look at the [Spring boot example](https://github.com/Bluesoul/hyaline-dto/tree/master/hyaline-dto-examples) to see Hyaline in action!\n\n## How to use it\n\nA simple Maven dependency:\n\n```xml\n\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.hyalinedto\u003c/groupId\u003e\n  \u003cartifactId\u003ehyalinedto\u003c/artifactId\u003e\n  \u003cversion\u003e0.9.1\u003c/version\u003e\n\u003c/dependency\u003e\n\n```\nor if you prefer Gradle:\n\n```compile 'org.hyalinedto:hyalinedto:0.9.1' ``` \n\n## News\n### 25/05/2015\nRelease 0.9.1 is out. Hyaline objects can now be passed as prototypes for new calls.\nCheck out the [Spring Boot example](https://github.com/Bluesoul/hyaline-dto/blob/master/hyaline-dto-examples/hyalinedto-springboot-rest-example/src/main/java/org/hyalinedto/examples/springbootrest/resources/PersonResource.java)(`/withFullName` endpoint) to see how! \n\n### 19/04/2015\nRelease 0.9.0 is finally out! \n\n### 22/03/2015\n\nA new snapshot providing dynamic access to dynamically created fields and new tests is now available.\nYou can now access dynamic fields as follows:\n\n```java\nPerson person = methodReturningInitializedPerson();\nPerson dto = Hyaline.dtoFromScratch(person, new DTO() {\n\t\n\t\tprivate String myNewField = \"Hello World!\";\n\n\t\t});\n\t\t\nHyalineDTO proxy = (HyalineDTO) dto;\t\t\n\nString hello = (String) proxy.getAttribute(\"myNewField\");\n\n```\n\nRemember that this way to access fields should be used only for dynamic fields.\nInherited fields can be accessed in a more efficient way by using getters and setters.\n\n\n### 13/03/2015\n\nA new snapshot containing several bug fixes is now available.\n\n```xml\n\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.hyalinedto\u003c/groupId\u003e\n  \u003cartifactId\u003ehyalinedto\u003c/artifactId\u003e\n  \u003cversion\u003e0.9.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003crepository\u003e\n  \u003cid\u003eoss-sonatype\u003c/id\u003e\n  \u003cname\u003eoss-sonatype\u003c/name\u003e\n  \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots/\u003c/url\u003e\n  \u003csnapshots\u003e\n    \u003cenabled\u003etrue\u003c/enabled\u003e\n  \u003c/snapshots\u003e\n\u003c/repository\u003e\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqzagarese%2Fhyaline-dto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqzagarese%2Fhyaline-dto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqzagarese%2Fhyaline-dto/lists"}