spmallette commented on code in PR #3211:
URL: https://github.com/apache/tinkerpop/pull/3211#discussion_r2440531350
##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1369,6 +1369,30 @@ java -cp target/run-examples-shaded.jar
examples.BasicGremlin
java -cp target/run-examples-shaded.jar examples.ModernTraversals
----
+[[gremlin-java-differences]]
+=== Differences
+
+Gremlin-Java provides additional syntactic sugar that leverages Java's type
system. Most notably, the `P.typeOf()`
+predicate accepts Java `Class` objects directly, providing a more natural and
type-safe way to perform type checking:
+
+[source,java]
+----
+// Java-specific syntax using Class objects
+g.V().values("age").is(P.typeOf(Integer.class))
+g.V().values("name").is(P.typeOf(String.class))
+g.V().has("weight", P.typeOf(Double.class))
+----
+
+This is equivalent to using `GType` enums, but offers compile-time type
checking and IDE support. Other Gremlin
+language variants must use the canonical `GType` enum approach:
+
+[source,java]
+----
+// Canonical syntax available in all languages
+g.V().values("age").is(P.typeOf(GType.INT))
+g.V().values("name").is(P.typeOf(GType.STRING))
+----
+
Review Comment:
i think it would be good to have some mention of what happens when you go
off the standard `GType` mappings. like what happens if you are in
`TinkerGraph` and store a `java.awt.Color`, will `typeOf(Color.class)` work for
that case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]