title: Get the value corresponding to a key in the properties of a TinkerVertex
body: <p>In Gremlin-Groovy, given a <a href="http://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.html" rel="nofollow noreferrer">TinkerVertex</a> object, what is the clearest/fastest way to retrieve the value corresponding to a key in its properties, returning a default value if it is not present (such as <code>null</code>)?</p>
  
  <p>This is how I am currently doing it:</p>
  
  <pre><code>def eval(vertex, field) {
      prop = vertex.property(field)
      prop.isPresent() ? prop.value() : null
  }
  </code></pre>
  
  <p>When the vertex doesn't have the desired field <code>vertex.property(field).value()</code>yields an exception, so I had to add that condition.</p>
  
  <p>Even if it is kind of short, this operation is done all the time and it bugs me that I haven't found any more "gremlinish" solution.</p>