You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Marko A. Rodriguez (JIRA)" <ji...@apache.org> on 2015/04/30 20:33:06 UTC
[jira] [Closed] (TINKERPOP3-478) Consider going full Optional
semantics on TraversalSideEffects
[ https://issues.apache.org/jira/browse/TINKERPOP3-478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marko A. Rodriguez closed TINKERPOP3-478.
-----------------------------------------
Resolution: Fixed
{{TraversalSideEffects}} now uses {{Optional}} on {{get()}}. This reduces the amount of code in {{TraversalSideEffects}} and makes it easy for Java8 people as its "just Optional."
> Consider going full Optional semantics on TraversalSideEffects
> --------------------------------------------------------------
>
> Key: TINKERPOP3-478
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-478
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Reporter: Marko A. Rodriguez
> Assignee: Marko A. Rodriguez
> Fix For: 3.0.0.GA
>
>
> Right now if you do {{TraversalSideEffects.get(key)}} and the value doesn't exist, you get an exception. The reason we did this was that we don't want {{null}} and we don't want {{Optional}} because users will interact with the sideEffects via {{Traverser}}. For example:
> {code:java}
> g.V().out().map{it.sideEffects(it.get().value('age'))+1}
> {code}
> However, note that {{Traverser.sideEffects()}} is a helper method to the more core {{Traverser.Admin.getSideEffects()}}. Thus, we can keep the non-Optional "user friendly" {{Traverser.sideEffects(key)}} method that throws the exception if the sideEffect doesn't exist. However, for vendors/developers, {{Optional}} seems the better choice so people don't have to do the awkard {{TraversalSideEffects.exists()}} method.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)