Skip to content

Instantly share code, notes, and snippets.

@dkuppitz
Created April 4, 2014 14:33
Show Gist options
  • Save dkuppitz/9975869 to your computer and use it in GitHub Desktop.
Save dkuppitz/9975869 to your computer and use it in GitHub Desktop.
class EnhancedVertex {
static void setOrRemoveProperty(final Vertex self, final String property, final def value) {
if (value == null) self.removeProperty(property) else self.setProperty(property, value)
}
}
g = TinkerGraphFactory.createTinkerGraph()
use (EnhancedVertex) {
marko = g.v(1)
marko.setOrRemoveProperty("foo", "bar")
marko.setOrRemoveProperty("name", null)
}
g.(1).map()
@timjstewart
Copy link

I had no idea you could do that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment