It doesn’t take a rocket scientist to create a better (relational) file format for JavaScript than XML
Douglas Crockford (Inventor of JSON)
EO - Elastic Objects
Elastic Objects give JSON a type to instantiate strong typed java objects in any place of an arbitrary object tree via configurations. It offers a path access methods to the underlying java objects.
Any object implementing
Call
When implementing web services there is no need to define different endpoints for object mapping or functionality. And one can combine any typed object and functionality in an arbitrary object tree. Since the underlying MVC framework provides no logic, it could be tested without the framework hassle.
There is also template call to parse for embedded typed json in an arbitrary text file. This is used for this web site.
New calls just need an entry in the model configurations.
And for the configured calls a new resource just needs an entry in file configurations or sql configurations.
The following working examples using html forms should show what's possible.
Simple Calls
SinusValueCall
SinusValueCall
File Calls
To allow access to files on the server side there are the file configurations with role permissions and the file location.
Read a Flat File
FileReadCall
public.txt
FileConfig.json#L302
The content of the file will set to the ≡targetPath "xyz".
Accessing An Excel File
XlsxReadCall
FileConfig.json#L2
The resulting list of maps is set to ≡targetPath "values".
Combining Data Request and Rendering
There is a template call which can be combined with a data call:
{TemplateDirResourceCall->examples, TemplateResourceCall.html}.Template Endpoint
WebEo.java
Templates contains marked typed JSON to offer functionality in any kind of text.
myString | myInt | myBoolean |
---|---|---|
value1 | 1 | true |
value2 | 2 | false |
value3 | 3 | false |
This table is created by embedded calls in a short form:
Essentially these calls are the same as the following which is the same as the example sent as JSON:
Csv, Excel and DB Together
All implemented list read calls are integrated in that editable template:
-
-
-
DbSqlConfig.json
Intention
Current concepts for computer communication using typed RPC pattern, if it's SOAP, REST or GraphQL.
As a result one need a lot of similar framework specific code for configuration and/or classes . Coding in such a procedural pattern is the boring part of being a programmer.
The original intention was to generate these boring parts by templates and
some structured information.
The
.
eo.xlsx
These templates using the same typed JSON for the active parts.
Conclusion
As a microservice architecture EO with version 0.9.3 is a "Proof of Concept" in Java: With a simple tiny type extension in JSON one could build services with a more object oriented approach.
The potential possibilities with bulletproofed database access or implementations in other programming languages are huge and far beyond a single person can realize.
So any ideas to bring it to a broader base are welcome.
Meanwhile focus will be the usage as a toolbox for the manipulation Java Objects and generation of code.