Source:
private static void addFilters(Context ctx, JSONObject jaggeryConfig) { if(jaggeryConfig != null) { JSONArray arrFilters = (JSONArray) jaggeryConfig.get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS); JSONArray arrFilterMappings = (JSONArray) jaggeryConfig.get(JaggeryCoreConstants.JaggeryConfigParams.FILTER_MAPPINGS); if (arrFilters != null) { for (Object filterObj : arrFilters) { JSONObject filter = (JSONObject) filterObj; String name = (String) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_NAME); String clazz = (String) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_CLASS); FilterDef filterDef = new FilterDef(); filterDef.setFilterName(name); filterDef.setFilterClass(clazz); JSONArray arrParams = (JSONArray) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_PARAMS); if (arrParams != null) { for (Object paramObj : arrParams) { JSONObject param = (JSONObject) paramObj; String paramName = (String) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_PARAMS_NAME); String paramValue = (String) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_PARAMS_VALUE); filterDef.addInitParameter(paramName, paramValue); } } ctx.addFilterDef(filterDef); } } if (arrFilterMappings != null) { for (Object filterMappingObj : arrFilterMappings) { JSONObject filterMapping = (JSONObject) filterMappingObj; String name = (String) filterMapping .get(JaggeryCoreConstants.JaggeryConfigParams.FILTER_MAPPINGS_NAME); String url = (String) filterMapping .get(JaggeryCoreConstants.JaggeryConfigParams.FILTER_MAPPINGS_URL); FilterMap filter1mapping = new FilterMap(); filter1mapping.setFilterName(name); filter1mapping.addURLPattern(url); ctx.addFilterMap(filter1mapping); } } } }

Target:
private static void addFilters(Context ctx, JSONObject jaggeryConfig) { if(jaggeryConfig != null) { JSONArray arrFilters = (JSONArray) jaggeryConfig.get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS); JSONArray arrFilterMappings = (JSONArray) jaggeryConfig.get(JaggeryCoreConstants.JaggeryConfigParams.FILTER_MAPPINGS); if (arrFilters != null) { for (Object filterObj : arrFilters) { JSONObject filter = (JSONObject) filterObj; String name = (String) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_NAME); String clazz = (String) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_CLASS); FilterDef filterDef = new FilterDef(); filterDef.setFilterName(name); filterDef.setFilterClass(clazz); JSONArray arrParams = (JSONArray) filter .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_PARAMS); if (arrParams != null) { for (Object paramObj : arrParams) { JSONObject param = (JSONObject) paramObj; String paramName = (String) param .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_PARAMS_NAME); String paramValue = (String) param .get(JaggeryCoreConstants.JaggeryConfigParams.FILTERS_PARAMS_VALUE); filterDef.addInitParameter(paramName, paramValue); } } ctx.addFilterDef(filterDef); } } if (arrFilterMappings != null) { for (Object filterMappingObj : arrFilterMappings) { JSONObject mapping = (JSONObject) filterMappingObj; String name = (String) mapping .get(JaggeryCoreConstants.JaggeryConfigParams.FILTER_MAPPINGS_NAME); String url = (String) mapping .get(JaggeryCoreConstants.JaggeryConfigParams.FILTER_MAPPINGS_URL); FilterMap filterMapping = new FilterMap(); filterMapping.setFilterName(name); filterMapping.addURLPattern(url); ctx.addFilterMap(filterMapping); } } } }