public static < QL > GremlinExpression getGremlinExpression ( QL expression , Map < String , Object > parameters ) { GremlinExpression gremlinExpression = null ; if ( expression instanceof String ) { gremlinExpression = new GremlinExpression ( "" , ( String ) expression ) ; } else if ( expression instanceof Gremlin ) { Gremlin gremlin = ( Gremlin ) expression ; gremlinExpression = new GremlinExpression ( gremlin . name ( ) , gremlin . value ( ) ) ; } else if ( AnnotatedElement . class . isAssignableFrom ( expression . getClass ( ) ) ) { AnnotatedElement < ? > typeExpression = ( AnnotatedElement < ? > ) expression ; gremlinExpression = extractExpression ( typeExpression ) ; } else if ( Class . class . isAssignableFrom ( expression . getClass ( ) ) ) { Class < ? > clazz = ( Class < ? > ) expression ; gremlinExpression = extractExpression ( clazz ) ; } else if ( Method . class . isAssignableFrom ( expression . getClass ( ) ) ) { Method method = ( Method ) expression ; gremlinExpression = extractExpression ( method ) ; } else { throw new XOException ( "Unsupported query expression " + expression . toString ( ) + "(class=" + expression . getClass ( ) + ")" ) ; } return applyParameters ( parameters , gremlinExpression ) ; }
This is a helper method to extract the Gremlin expression .