1 package com.ljs.ootp.extract.html.loader;
2
3
4
5
6
7 public final class PageLoaderBuilder {
8
9 private PageLoader loader = new JsoupLoader();
10
11 private PageLoaderBuilder() { }
12
13 public PageLoaderBuilder inMemoryCache() {
14 loader = InMemoryCachedLoader.wrap(loader);
15 return this;
16 }
17
18 public PageLoaderBuilder diskCache() {
19 loader = DiskCachingLoader.wrap(loader);
20 return this;
21 }
22
23 public PageLoaderBuilder diskCache(String dir) {
24 loader = DiskCachingLoader.create(dir, loader);
25 return this;
26 }
27
28 public PageLoader build() {
29 return loader;
30 }
31
32 public static PageLoaderBuilder create() {
33 return new PageLoaderBuilder();
34 }
35
36 }