Class LazyHeaders.Builder
- java.lang.Object
-
- com.bumptech.glide.load.model.LazyHeaders.Builder
-
- Enclosing class:
- LazyHeaders
public static final class LazyHeaders.Builder extends java.lang.ObjectAdds anLazyHeaderFactorythat will be used to construct a value for the given key* lazily on a background thread.This class is not thread safe.
This class may include default values for User-Agent and Accept-Encoding headers. These will be replaced by calls to either
setHeader(String, LazyHeaderFactory)oraddHeader(String, String), even thoughaddHeader(String, LazyHeaderFactory)would usually append an additional value.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LazyHeaders.BuilderaddHeader(java.lang.String key, LazyHeaderFactory factory)Adds anLazyHeaderFactorythat will be used to construct a value for the given key lazily on a background thread.LazyHeaders.BuilderaddHeader(java.lang.String key, java.lang.String value)Adds a value for the given header and returns this builder.LazyHeadersbuild()Returns a new immutableLazyHeadersobject.LazyHeaders.BuildersetHeader(java.lang.String key, LazyHeaderFactory factory)Replaces all existingLazyHeaderFactorysfor the given key with the givenLazyHeaderFactory.LazyHeaders.BuildersetHeader(java.lang.String key, java.lang.String value)Replaces all existingLazyHeaderFactorysfor the given key with the givenLazyHeaderFactory.
-
-
-
Method Detail
-
addHeader
public LazyHeaders.Builder addHeader(@NonNull java.lang.String key, @NonNull java.lang.String value)
Adds a value for the given header and returns this builder.Use
addHeader(String, LazyHeaderFactory)if obtaining the value requires I/O (i.e. an OAuth token).- See Also:
addHeader(String, LazyHeaderFactory)
-
addHeader
public LazyHeaders.Builder addHeader(@NonNull java.lang.String key, @NonNull LazyHeaderFactory factory)
Adds anLazyHeaderFactorythat will be used to construct a value for the given key lazily on a background thread.Headers may have multiple values whose order is defined by the order in which this method is called.
This class does not prevent you from adding the same value to a given key multiple times
-
setHeader
public LazyHeaders.Builder setHeader(@NonNull java.lang.String key, @Nullable java.lang.String value)
Replaces all existingLazyHeaderFactorysfor the given key with the givenLazyHeaderFactory.If the given value is
null, the header at the given key will be removed.Use
setHeader(String, LazyHeaderFactory)if obtaining the value requires I/O (i.e. an OAuth token).
-
setHeader
public LazyHeaders.Builder setHeader(@NonNull java.lang.String key, @Nullable LazyHeaderFactory factory)
Replaces all existingLazyHeaderFactorysfor the given key with the givenLazyHeaderFactory.If the given value is
null, the header at the given key will be removed.
-
build
public LazyHeaders build()
Returns a new immutableLazyHeadersobject.
-
-