/** * Validate the configuration and build a new {@link JsonItemReader}. * @return a new instance of the {@link JsonItemReader} */ public JsonItemReader<T> build() { Assert.notNull(this.jsonObjectReader, "A json object reader is required."); Assert.notNull(this.resource, "A resource is required."); if (this.saveState) { Assert.state(StringUtils.hasText(this.name), "A name is required when saveState is set to true."); } JsonItemReader<T> reader = new JsonItemReader<>(this.resource, this.jsonObjectReader); reader.setName(this.name); reader.setStrict(this.strict); reader.setSaveState(this.saveState); reader.setMaxItemCount(this.maxItemCount); reader.setCurrentItemCount(this.currentItemCount); return reader; } }
/** * Validate the configuration and build a new {@link JsonItemReader}. * @return a new instance of the {@link JsonItemReader} */ public JsonItemReader<T> build() { Assert.notNull(this.jsonObjectReader, "A json object reader is required."); Assert.notNull(this.resource, "A resource is required."); if (this.saveState) { Assert.state(StringUtils.hasText(this.name), "A name is required when saveState is set to true."); } JsonItemReader<T> reader = new JsonItemReader<>(this.resource, this.jsonObjectReader); reader.setName(this.name); reader.setStrict(this.strict); reader.setSaveState(this.saveState); reader.setMaxItemCount(this.maxItemCount); reader.setCurrentItemCount(this.currentItemCount); return reader; } }