[ 
https://issues.apache.org/jira/browse/TINKERPOP-1901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395407#comment-16395407
 ] 

ASF GitHub Bot commented on TINKERPOP-1901:
-------------------------------------------

Github user FlorianHockmann commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/815#discussion_r173842052
  
    --- Diff: gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs 
---
    @@ -26,11 +26,16 @@ namespace Gremlin.Net.Process.Traversal
     {
     #pragma warning disable 1591
     
    -    public enum Cardinality
    +    public class Cardinality : EnumWrapper
         {
    -        List,
    -           Set,
    -           Single
    +        private Cardinality(string enumValue)
    +            : base("Cardinality", enumValue)
    +        {            
    +        }
    +
    +        public static Cardinality List => new Cardinality("list");
    +           public static Cardinality Set => new Cardinality("set");
    --- End diff --
    
    I decided to go with the latter so that the template can handle the 
formatting itself.


> Enable usage of enums in more steps in Gremlin.Net
> --------------------------------------------------
>
>                 Key: TINKERPOP-1901
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1901
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: dotnet
>    Affects Versions: 3.2.7, 3.3.1
>            Reporter: Florian Hockmann
>            Assignee: Florian Hockmann
>            Priority: Minor
>             Fix For: 3.2.8, 3.3.2
>
>
> 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:
> {code:java}
> public default <V> GraphTraversal<S, E> by(final Traversal<?, ?> traversal, 
> final Comparator<V> comparator)
> {code}
>  * In Gremlin.Net:
> {code}
> public GraphTraversal<S, E> By (object function, object comparator)
> {code}
> [~jorgebg] [suggested two possible 
> solutions|https://github.com/apache/tinkerpop/pull/792#discussion_r167847541] 
> for this problem:
> {quote} * 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.{quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to