Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EDT:JSONConversionJavaGenerationAndRuntime

Java Plugins

org.eclipse.edt.gen.java.templates.jee:

The Handler and Record preGenAnnotations scans fields for an EGL JSONName annotation, if the annotation does not exist 1 is added to field. Annotation generation has a template for each annotation type. When the JSONName annotation is encountered by the generator the JSONNameTemplate is used to generate the JSON annotation runtime class org.eclipse.edt.javart.json.Json. If the field has a getter method the annotation is generated on the getter, if no getter is present the annotation is generated on the field. The JSON annotation contains:

  • the JSON name
  • the field type,
  • the constructor options so the convertFromJson can create a new instance of the field.


org.eclipse.edt.runtime.java.jee:

The JSON string parser is located in org.eclipse.edt.javart.json. This parser converts the JSON string into the objects located in this package.

The Json parser converts the JSON string into the objects. eglx.json.JSONLib

   convertToJSON: loops through each field creating a name value pair.
   convertFrom JSON first parses the 'JSON' string into intermediate objects.
       Then loops through the egl fields for each field
           Uses the JSON name from the annotations to get the JSON value
           Uses the clazz and asOptions to assign the value to the field. 

Dictionaries have no generated annotations values are converted based on the JSON type not the EGL type.

Back to the top