graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java
@SuppressWarnings("unchecked")
  @Override
  public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) {
    makeActive();

    final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager();
    final OIndex idx = indexManager.getIndex(indexName);
    if (idx == null || !hasIndexClass(idx))
      return null;

    final Index<? extends Element> index = new OrientIndex(this, idx);

    if (indexClass.isAssignableFrom(index.getIndexClass()))
      return (Index<T>) index;
    else
      throw ExceptionFactory.indexDoesNotSupportClass(indexName, indexClass);
  }
@SuppressWarnings("unchecked")
  @Override
  public <T extends Element> Index<T> getIndex(final String indexName, final Class<T> indexClass) {
    makeActive();

    final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager();
    final OIndex idx = indexManager.getIndex(indexName);
    if (idx == null || !hasIndexClass(idx))
      return null;

    final Index<? extends Element> index = new OrientIndex(this, idx);

    if (indexClass.isAssignableFrom(index.getIndexClass()))
      return (Index<T>) index;
    else
      throw ExceptionFactory.indexDoesNotSupportClass(indexName, indexClass);
  }
@ SuppressWarnings ( "unchecked" ) @ Override public < T extends Element > Index < T > getIndex ( final String indexName , final Class < T > indexClass ) { makeActive ( ) ; final OIndexManager indexManager = getDatabase ( ) . getMetadata ( ) . getIndexManager ( ) ; final OIndex idx = indexManager . getIndex ( indexName ) ; if ( idx == null || ! hasIndexClass ( idx ) ) return null ; final Index < ? extends Element > index = new OrientIndex ( this , idx ) ; if ( indexClass . isAssignableFrom ( index . getIndexClass ( ) ) ) return ( Index < T > ) index ; else throw ExceptionFactory . indexDoesNotSupportClass ( indexName , indexClass ) ; }
Returns an index by name and class

@param indexName  Index name
@param indexClass Class as one or subclass of Vertex.class and Edge.class

@return Index instance
Returns an index by name and class