Skip to content
Pedro Victor Arouck Melo edited this page Dec 17, 2019 · 28 revisions

Welcome to the DrawToCode wiki!

Adding Programming Languages

Create a Language Package

You need to create a package for the language on src/plantToCode/dataToCode and implement the following interfaces:

  • classToCode.py
  • fileNameToCode.py
  • inheritanceToCode.py
  • interfaceToCode.py
  • languageInterface.py
  • methodModifierToCode.py
  • methodToCode.py

To see a practical example, go to src/plantToCode/dataToCode/toPython

Add the Language on the select_language() method

The method is located at src/plantToCode/write_files.py

def select_language(language: str) -> LanguageInterface:
    language_writer: LanguageInterface
    if language == "python":
        language_writer = LanguagePython()
    elif language == "java":
        language_writer = LanguageJava()
    else:
        raise ValueError("This language is not implemented")
    return language_writer

DrawIo Rules

To use our solution there are some rules:

  1. It only accept Class5 class box and Interface2 interface box;
  2. Classes and Interfaces names should be in bold;
  3. Attributes must have a name and a type sepparated by :
  4. To use inheritances and implementations, you must use these arrows:
  5. To use interfaces you have to erase attributes fiels, using backspace until it erases the hr line like the image bellow: