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

Enable usage of enums in more steps in Gremlin.Net

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.7, 3.3.1
    • Fix Version/s: 3.2.8, 3.3.2
    • Component/s: dotnet
    • Labels:
      None

      Description

      Java enums can implement interfaces and some Gremlin steps take interfaces as arguments that are implemented by enums like T or P in Java. However, C# enums can't have any methods and therefore also not implement interfaces. For this reason, step arguments whose type is one of those interfaces (Predicate, Function, ...) currently have the type object in Gremlin.Net which makes it hard for users to know what kind of values they can use for these arguments.

      This overload of the By step is a good example for this:

      • In Gremlin-java:
        public default <V> GraphTraversal<S, E> by(final Traversal<?, ?> traversal, final Comparator<V> comparator)
        
      • In Gremlin.Net:
        public GraphTraversal<S, E> By (object function, object comparator)
        

      Jorge Bay suggested two possible solutions for this problem:

      • Use a class for T (not an enum), properties like T.Id could return instances of whatever interface we create for it. Given that java enums functionality is more comprehensive than what C# currently supports, it makes sense to use a class IMO.
      • Generate the offending traversal methods manually.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Florian Hockmann Florian Hockmann
                Reporter:
                Florian Hockmann Florian Hockmann
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: