{"id":16416082,"url":"https://github.com/phax/ph-jdmc","last_synced_at":"2025-10-26T19:32:05.026Z","repository":{"id":39861948,"uuid":"156024526","full_name":"phax/ph-jdmc","owner":"phax","description":"Java Domain Model Generator (jdmc)","archived":false,"fork":false,"pushed_at":"2024-09-17T09:32:02.000Z","size":1653,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T23:05:50.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/phax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-11-03T21:16:11.000Z","updated_at":"2024-09-17T09:32:06.000Z","dependencies_parsed_at":"2023-11-07T14:41:29.167Z","dependency_job_id":"6014ebea-b352-4067-9442-2f865457ca71","html_url":"https://github.com/phax/ph-jdmc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fph-jdmc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fph-jdmc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fph-jdmc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fph-jdmc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phax","download_url":"https://codeload.github.com/phax/ph-jdmc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"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-10-11T07:08:22.059Z","updated_at":"2025-10-26T19:32:03.925Z","avatar_url":"https://github.com/phax.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ph-jdmc\n\nStatus: last release is **0.0.5** (2021-03-22)\n\nJava Domain Model Creator (jdmc).\nThe source structure is defined in JSON, and the domain model, test classes and XML serialization for usage on the \"ph-\" stack is created.\nSee the `ph-jdmc-example` subproject at https://github.com/phax/ph-jdmc/tree/master/ph-jdmc-example which is purely created by the unit tests of `ph-jdmc-core`.\n\nThe `ph-jdmc-maven-plugin` subproject is a Maven plugin to use JDMC in your projects.\n\n## File format\n\nThe `.jdm` files are JSON files having a certain predefined layout.\nThere are two main file layouts - one for enumerations and one for classes.\nIn both cases the basename of the file determines the destination class name.\nSo the filename `Age.jdm` creates either an enum `Age` or a class `Age`.\n\n### Enum file format \n\nA simple enumeration with three entries can be defined like this:\n\n```json\n{\n  \"RED\" : \"r\",\n  \"GREEN\" : \"g\",\n  \"BLUE\" : \"b\"\n}\n```\n\nThis defines an enum with the enumeration constants `RED`, `GREEN` and `BLUE`.\nThe strings on the right side define the internal ID of the object. So enumeration constant `RED` has the internal ID `r`, `BLUE` has `b` etc.\n\nThe created class looks like this assuming the file was labeled `EDemo1.jdm`:\n\n```java\npublic enum EDemo1\n  implements IHasID\u003cString\u003e , IHasDisplayName\n{\n  RED(\"r\", \"r\"),\n  GREEN(\"g\", \"g\"),\n  BLUE(\"b\", \"b\");\n  private final String m_sID;\n  private final String m_sDisplayName;\n\n  private EDemo1(@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sDisplayName) {\n    m_sID = sID;\n    m_sDisplayName = sDisplayName;\n  }\n\n  @Nonnull\n  @Nonempty\n  public String getID() {\n    return m_sID;\n  }\n\n  @Nonnull\n  @Nonempty\n  public String getDisplayName() {\n    return m_sDisplayName;\n  }\n\n  @Nullable\n  public static EDemo1 getFromIDOrNull(@Nullable final String sID) {\n    return EnumHelper.getFromIDOrNull(EDemo1 .class, sID);\n  }\n\n  @Nullable\n  public static EDemo1 getFromIDOrDefault(@Nullable final String sID, @Nullable final EDemo1 eDefault) {\n    return EnumHelper.getFromIDOrDefault(EDemo1 .class, sID, eDefault);\n  }\n\n  @Nonnull\n  public static EDemo1 getFromIDOrThrow(@Nullable final String sID) {\n    return EnumHelper.getFromIDOrThrow(EDemo1 .class, sID);\n  }\n}\n```\n\nInstead of just a simple ID (the string `\"r\"` in the above example) also a more sophisticated information can be provided.\nWhen using a JSON array, the first entry is the internal ID, the second String is the \"display name\" associated with the entry, and the third entry is the source code comment.\nIf the array has one entry, the internal ID and the display name contain this value, but no comment is used.\nIf the array has two entries, the internal ID and the display name are, whereas the comment still stays empty.\nIf the array has more than three entries, the values are ignored.\nOf course the definitions can be mixed between the different enum constants, so one entry can only have the ID, whereas another entry can have the internal ID, a display name and a comment.\n\nSo the following example is a valid enumeration definition:\n\n```json\n{\n  \"ALPHA\" : \"a\",\n  \"RED\" : [ \"r\" ],\n  \"GREEN\" : [ \"g\", \"green\", \"The green part.\" ],\n  \"BLUE\" :  [ \"b\", \"blue\" ]\n}\n```\n\nAlternatively an object can be used to describe the same values in a more explicit way (since v0.0.4):\n\n```json\n{\n  \"ALPHA\" : { \"id\": \"a\" },\n  \"RED\" :   {},\n  \"GREEN\" : { \"id\": \"g\", \"name\": \"green\", \"comment\": \"The green part.\" },\n  \"BLUE\" :  [ \"id\": \"b\", \"name\": \"blue\" }\n}\n```\n\nThe created code looks as follows, assuming the definition was in file `EDemo2.jdm`.\nNote: The common parts (starting after the constructor) where omitted because it is identical to the previous example:\n\n```java\npublic enum EDemo2\n  implements IHasID\u003cString\u003e , IHasDisplayName\n{\n  ALPHA(\"a\", \"a\"),\n  RED(\"r\", \"r\"),\n\n  /**\n   * The green part.\n   */\n  GREEN(\"g\", \"green\"),\n  BLUE(\"b\", \"blue\");\n  private final String m_sID;\n  private final String m_sDisplayName;\n\n  private EDemo2(@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sDisplayName) {\n    m_sID = sID;\n    m_sDisplayName = sDisplayName;\n  }\n  ...\n}\n```\n\n# News and noteworthy\n\n* v0.0.5 - 2021-03-22\n    * Updated to ph-commons 10\n* v0.0.4 - 2019-11-05\n    * Updated to ph-oton 8.2.0\n    * Maven plugin parameter `createManager` is now set correctly\n    * Allowing for JSON Object for enum and class members\n    * Added new `JDMProcessor.reader()` to allow for forward reference resolution\n* v0.0.3 - 2019-02-11\n    * Added the possibility to create self referencing types (optional only)\n    * Added base types `char` and `Character` as numeric types\n    * Added per-field settings (currently on `businessObjectReference` for XML serialization only)\n* v0.0.2 - 2019-02-02\n    * Fixed the code generation for serialization of optional primitive types (e.g. `int?`)\n* v0.0.1 - 2019-01-24\n    * Initial code generation\n\n---\n\nMy personal [Coding Styleguide](https://github.com/phax/meta/blob/master/CodingStyleguide.md) |\nOn Twitter: \u003ca href=\"https://twitter.com/philiphelger\"\u003e@philiphelger\u003c/a\u003e |\nKindly supported by [YourKit Java Profiler](https://www.yourkit.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphax%2Fph-jdmc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphax%2Fph-jdmc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphax%2Fph-jdmc/lists"}