Skip to content

A parser from JSON representation to Java object of Datamodel

Notifications You must be signed in to change notification settings

MoDELSVGU/datamodel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datamodel

A parser component that parses JSON representation to Java object hierarchy for our datamodel.

<dependency>
  <groupId>io.github.modelsvgu</groupId>
  <artifactId>datamodelj</artifactId>
  <version>[1.0.0,)</version>
</dependency>

Current support includes:

  • Classes.
  • Attributes with primitive types such as Integer and String.
  • Association: binary associations.
  • Association-classes.

To use it please call it via the following method:

DataModel dm = DMParser.parse(<datamodel_filepath>);

Example: The following representation is depricated but still supported.

[
  {
    "class": "Lecturer",
    "attributes": [
      {
        "name": "name",
        "type": "String"
      },
      {
        "name": "age",
        "type": "Integer"
      }
    ],
    "ends": [
      {
        "association": "Enrollment",
        "name": "students",
        "target": "Student",
        "opp": "lecturers",
        "mult": "*"
      }
    ]
  },
  {
    "class": "Student",
    "attributes": [
      {
        "name": "name",
        "type": "String"
      },
      {
        "name": "age",
        "type": "Integer"
      }
    ],
    "ends": [
      {
        "association": "Enrollment",
        "name": "lecturers",
        "target": "Lecturer",
        "opp": "students",
        "mult": "*"
      }
    ]
  }
]

For newer representation, please add a version tag:

{
	"version": "1.0.6-ASC",
	"dataModel": [
		{
			"class": "Lecturer",
			"attributes": [
				{
					"name": "name",
					"type": "String"
				},
				{
					"name": "email",
					"type": "String"
				},
				{
					"name": "age",
					"type": "Integer"
				}
			]
		},
		{
			"class": "Student",
			"attributes": [
				{
					"name": "name",
					"type": "String"
				},
				{
					"name": "email",
					"type": "String"
				},
				{
					"name": "age",
					"type": "Integer"
				}
			]
		},
		{
			"association": "Enrolment",
			"ends": [
				{
					"name": "students",
					"target": "Student",
					"mult": "*"
				},
				{
					"name": "lecturers",
					"target": "Lecturer",
					"mult": "*"
				}
			]
		}
	]
}

About

A parser from JSON representation to Java object of Datamodel

Resources

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages