Class StorageFetcher.Builder

  • Enclosing class:
    StorageFetcher

    public static final class StorageFetcher.Builder
    extends Object
    A builder for StorageFetcher class.
    • Method Detail

      • setHeaders

        public StorageFetcher.Builder setHeaders​(@NotNull
                                                 @NotNull Map<String,​String> headers)
        Sets the headers to be used when fetching items. Defaults to none.
        Parameters:
        headers - a map to headers to be used.
        Returns:
        this
      • setValidator

        public StorageFetcher.Builder setValidator​(@NotNull
                                                   @NotNull Validator validator)
        Sets the Validator to be used. Defaults to StatusOkValidator and EmptyContentValidator.

        This will validate the fetched page and retry if page is not consistent with the specification set by the validator.

        Parameters:
        validator - validator to be used.
        Returns:
        this
      • setValidator

        public StorageFetcher.Builder setValidator​(@NotNull
                                                   @NotNull Validator... validators)
        Sets the multiple validators to be used. Defaults to StatusOkValidator and EmptyContentValidator.

        This will validate the fetched page and retry if page is not consistent with the specification set by the validator.

        Parameters:
        validators - validator to be used.
        Returns:
        this
      • build

        public StorageFetcher build()
        Builds the fetcher with the options specified.
        Returns:
        an instance of Fetcher.