Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2371

Add possibility to import constants with ImportGremlinPlugin

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Done
    • 3.4.6
    • 3.5.0, 3.4.7
    • plugin
    • None

    Description

      We use Gremlin Requests in Java, and we want to use them in a personalized Gremlin console. The main interest of having this console is to use our DSL, which is made up with methods and constants defined in Java, which complete the Gremlin language. Therefore, we want to be able to import constants with ImportGremlinPlugin, just as we can import methods.

      For example, in the file Labels.java, we have defined the constant:

      public static class MyProject {
         public static final String DEVICE = "device";
         public static final String NAME = "name";
      }
      

      And, in our console, we want to be able to submit the request:

      g.addV(DEVICE).property(NAME, "foo")

      instead of using the request:

      g.addV("device").property("name", "foo")
      

      Note: We have been able to make following code works: g.addV(MyProject .DEVICE).property(MyProject .NAME, "foo") but we would prefer to static import of MyProject.*.

      We are ready to developed a pull request, but before starting it, we would like to know if another solution exists or if such improvement may be accepted ?
       

      Attachments

        Activity

          People

            spmallette Stephen Mallette
            trangosi Nicolas Trangosi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: