ElementTuple implements Tuple<String> { @Override public Object get(final String reference) { if (ELEMENT.equals(reference)) { return element; } if (PROPERTIES.equals(reference)) { return element.getProperties(); } final IdentifierType idType = IdentifierType.fromName(reference); if (null == idType) { return element.getProperty(reference); } return element.getIdentifier(idType); } ElementTuple();  ElementTuple(final Element element); Element getElement(); void setElement(final Element element); @Override Object get(final String reference); @Override Iterable<Object> values(); @Override void put(final String reference, final Object value); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); static final String ELEMENT; static final String PROPERTIES; }
@Test public void shouldGetValues() { final Edge edge = new Edge.Builder() .group("group") .source("source vertex") .dest("destination vertex") .directed(true) .matchedVertex(EdgeId.MatchedVertex.SOURCE) .property(TestPropertyNames.COUNT, 1) .build(); final ElementTuple tuple = new ElementTuple(edge); assertEquals("source vertex", tuple.get(IdentifierType.SOURCE.name())); assertEquals("destination vertex", tuple.get(IdentifierType.DESTINATION.name())); assertEquals(true, tuple.get(IdentifierType.DIRECTED.name())); assertEquals("source vertex", tuple.get(IdentifierType.MATCHED_VERTEX.name())); assertEquals("destination vertex", tuple.get(IdentifierType.ADJACENT_MATCHED_VERTEX.name())); assertEquals(1, tuple.get(TestPropertyNames.COUNT)); }