LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
| 17 |
17 package org.adblockplus.libadblockplus; | 18 package org.adblockplus.libadblockplus; |
18 | 19 |
19 public class AppInfo | 20 public class AppInfo |
20 { | 21 { |
21 public final String id; | 22 public final String id; |
22 public final String version; | 23 public final String version; |
23 public final String name; | 24 public final String name; |
24 public final String application; | 25 public final String application; |
25 public final String applicationVersion; | 26 public final String applicationVersion; |
26 public final String locale; | 27 public final String locale; |
27 public final boolean developmentBuild; | 28 public final boolean developmentBuild; |
28 | 29 |
29 // TODO: Builder or not? | 30 private AppInfo(final String id, final String version, final String name, fina
l String application, final String applicationVersion, |
30 public AppInfo(final String id, final String version, final String name, final
String application, final String applicationVersion, | |
31 final String locale, final boolean developmentBuild) | 31 final String locale, final boolean developmentBuild) |
32 { | 32 { |
33 this.id = id; | 33 this.id = id; |
34 this.version = version; | 34 this.version = version; |
35 this.name = name; | 35 this.name = name; |
36 this.application = application; | 36 this.application = application; |
37 this.applicationVersion = applicationVersion; | 37 this.applicationVersion = applicationVersion; |
38 this.locale = locale; | 38 this.locale = locale; |
39 this.developmentBuild = developmentBuild; | 39 this.developmentBuild = developmentBuild; |
40 } | 40 } |
| 41 |
| 42 public static Builder builder() |
| 43 { |
| 44 return new Builder(); |
| 45 } |
| 46 |
| 47 public static class Builder |
| 48 { |
| 49 private String id = ""; |
| 50 private String version = "0"; |
| 51 private String name = "adblockplusandroid"; |
| 52 private String application = "android"; |
| 53 private String applicationVersion = "0"; |
| 54 private String locale = "en_US"; |
| 55 private boolean developmentBuild = false; |
| 56 |
| 57 private Builder() |
| 58 { |
| 59 |
| 60 } |
| 61 |
| 62 public Builder setId(final String id) |
| 63 { |
| 64 this.id = id; |
| 65 return this; |
| 66 } |
| 67 |
| 68 public Builder setVersion(final String version) |
| 69 { |
| 70 this.version = version; |
| 71 return this; |
| 72 } |
| 73 |
| 74 public Builder setName(final String name) |
| 75 { |
| 76 this.name = name; |
| 77 return this; |
| 78 } |
| 79 |
| 80 public Builder setApplication(final String application) |
| 81 { |
| 82 this.application = application; |
| 83 return this; |
| 84 } |
| 85 |
| 86 public Builder setApplicationVersion(final String applicationVersion) |
| 87 { |
| 88 this.applicationVersion = applicationVersion; |
| 89 return this; |
| 90 } |
| 91 |
| 92 public Builder setLocale(final String locale) |
| 93 { |
| 94 this.locale = locale; |
| 95 return this; |
| 96 } |
| 97 |
| 98 public Builder setDevelopmentBuild(final boolean developmentBuild) |
| 99 { |
| 100 this.developmentBuild = developmentBuild; |
| 101 return this; |
| 102 } |
| 103 |
| 104 public AppInfo build() |
| 105 { |
| 106 return new AppInfo(this.id, this.version, this.name, this.application, thi
s.applicationVersion, this.locale, this.developmentBuild); |
| 107 } |
| 108 } |
41 } | 109 } |
LEFT | RIGHT |