All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tinkerpop.gremlin.groovy.loaders.IndexLoader.groovy Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package com.tinkerpop.gremlin.groovy.loaders

import com.tinkerpop.blueprints.Index
import com.tinkerpop.blueprints.IndexableGraph
import com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
class IndexLoader {

    public static void load() {

        IndexableGraph.metaClass.idx = { final Object indexName ->
            return ((IndexableGraph) delegate).getIndices().find { it.getIndexName().equals(indexName) }
        }

        Index.metaClass.getAt = { final Map query ->
            final Map.Entry entry = (Map.Entry) query.iterator().next();
            return new GremlinGroovyPipeline().start((((Index) delegate).get((String) entry.getKey(), entry.getValue())));
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy