Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate code for multiple languages from within Android studio?

I am writing code for a cloud based NoSQL Database in Android Studio and realized that I also need some backend processing in a different language for the same data set. Now I would prefer to not repeat the field and document names both in Java and in the other language (node.js, php, python, you name it).

Can this be done from within Android Studio? I am aware that I can create my custom gradle task but gradle is only an automation tool it does not transform data etc.

I've found various tools for code gen creating activities etc but nothing more general, e.g consuming some DSL and generating java and other files.

like image 395
Samuel Avatar asked Mar 10 '26 20:03

Samuel


1 Answers

If you want to generate the backend code, you can try Telosys http://www.telosys.org/

This tool has a DSL to define a model and it can generate code for different kind of languages (Java, Python, NodeJS, etc ). Typically for REST services.

It's possible to use the CLI version as a companion tool for your favorite IDE (like Android Studio)

For NodeJS you can try this set of templates: https://github.com/so-technology-watch/telosys-templates-nodejs

For Python you can use the following templates :

Python REST with Bottle : https://github.com/telosys-templates-v3/python-web-rest-bottle

Python persistence with SQL alchemy : https://github.com/telosys-templates-v3/python-persistence-sqlalchemy

And for Java there are different kinds of persistence templates here : https://github.com/telosys-templates-v3 (JPA, Redis, Mongo, etc )

like image 77
lgu Avatar answered Mar 12 '26 10:03

lgu