@ Override public Iterator < Object [ ] > getDataByFilter ( DataProviderFilter dataFilter ) { Preconditions . checkArgument ( resource != null , "File resource cannot be null" ) ; logger . entering ( dataFilter ) ; Class < ? > arrayType ; JsonReader reader = null ; try { reader = new JsonReader ( getReader ( resource ) ) ; arrayType = Array . newInstance ( resource . getCls ( ) , 0 ) . getClass ( ) ; Gson myJson = new Gson ( ) ; Object [ ] mappedData = myJson . fromJson ( reader , arrayType ) ; return prepareDataAsObjectArrayList ( mappedData , dataFilter ) . iterator ( ) ; } catch ( Exception e ) { throw new DataProviderException ( e . getMessage ( ) , e ) ; } finally { IOUtils . closeQuietly ( reader ) ; } }
Gets JSON data from a resource by applying the given filter .