@Override
    public Object[][] getDataByIndex(int[] indexes) {
        validateResourceParams(resource);
        Preconditions.checkArgument((indexes.length != 0), "Indexes cannot be empty");
        logger.entering(indexes);
        Object[][] requestedData = null;
        Class<?> arrayType;
        JsonReader reader = null;
        try {

            requestedData = new Object[indexes.length][1];
            reader = new JsonReader(getReader(resource));
            arrayType = Array.newInstance(resource.getCls(), 0).getClass();
            logger.log(Level.FINE, "The Json Data is mapped as", arrayType);
            Object[][] mappedData = mapJsonData(reader, arrayType);
            int i = 0;
            for (int indexVal : indexes) {
                indexVal--;
                requestedData[i] = mappedData[indexVal];
                i++;
            }
        } catch (IOException e) {
            throw new DataProviderException("Error while getting the data by index from Json file", e);
        } finally {
            IOUtils.closeQuietly(reader);
        }
        logger.exiting((Object[]) requestedData);
        return requestedData;
    }
@ Override public Object [ ] [ ] getDataByIndex ( int [ ] indexes ) { validateResourceParams ( resource ) ; Preconditions . checkArgument ( ( indexes . length != 0 ) , "Indexes cannot be empty" ) ; logger . entering ( indexes ) ; Object [ ] [ ] requestedData = null ; Class < ? > arrayType ; JsonReader reader = null ; try { requestedData = new Object [ indexes . length ] [ 1 ] ; reader = new JsonReader ( getReader ( resource ) ) ; arrayType = Array . newInstance ( resource . getCls ( ) , 0 ) . getClass ( ) ; logger . log ( Level . FINE , "The Json Data is mapped as" , arrayType ) ; Object [ ] [ ] mappedData = mapJsonData ( reader , arrayType ) ; int i = 0 ; for ( int indexVal : indexes ) { indexVal -- ; requestedData [ i ] = mappedData [ indexVal ] ; i ++ ; } } catch ( IOException e ) { throw new DataProviderException ( "Error while getting the data by index from Json file" , e ) ; } finally { IOUtils . closeQuietly ( reader ) ; } logger . exiting ( ( Object [ ] ) requestedData ) ; return requestedData ; }
Gets JSON data from a resource for the specified indexes.

@param indexes
The set of indexes to be fetched from the JSON file.