Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/org/adblockplus/libadblockplus/AppInfo.java

Issue 6606493159784448: New JNI bindings (Closed)
Patch Set: Changed AppInfo to use builder pattern. Created April 11, 2014, 1:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 package org.adblockplus.libadblockplus;
19
20 public class AppInfo
21 {
22 public final String id;
23 public final String version;
24 public final String name;
25 public final String application;
26 public final String applicationVersion;
27 public final String locale;
28 public final boolean developmentBuild;
29
30 // TODO: Builder or not?
31 private AppInfo(final String id, final String version, final String name, fina l String application, final String applicationVersion,
32 final String locale, final boolean developmentBuild)
33 {
34 this.id = id;
35 this.version = version;
36 this.name = name;
37 this.application = application;
38 this.applicationVersion = applicationVersion;
39 this.locale = locale;
40 this.developmentBuild = developmentBuild;
41 }
42
43 public static Builder builder()
44 {
45 return new Builder();
46 }
47
48 public static class Builder
49 {
50 private String id = "";
51 private String version = "0";
52 private String name = "adblockplusandroid";
53 private String application = "android";
54 private String applicationVersion = "0";
55 private String locale = "en_US";
56 private boolean developmentBuild = false;
57
58 private Builder()
59 {
60
61 }
62
63 public Builder setId(final String id)
64 {
65 this.id = id;
66 return this;
67 }
68
69 public Builder setVersion(final String version)
70 {
71 this.version = version;
72 return this;
73 }
74
75 public Builder setName(final String name)
76 {
77 this.name = name;
78 return this;
79 }
80
81 public Builder setApplication(final String application)
82 {
83 this.application = application;
84 return this;
85 }
86
87 public Builder setApplicationVersion(final String applicationVersion)
88 {
89 this.applicationVersion = applicationVersion;
90 return this;
91 }
92
93 public Builder setLocale(final String locale)
94 {
95 this.locale = locale;
96 return this;
97 }
98
99 public Builder setDevelopmentBuild(final boolean developmentBuild)
100 {
101 this.developmentBuild = developmentBuild;
102 return this;
103 }
104
105 public AppInfo build()
106 {
107 return new AppInfo(this.id, this.version, this.name, this.application, thi s.applicationVersion, this.locale, this.developmentBuild);
108 }
109 }
110 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/libadblockplus/AdblockPlusException.java ('k') | src/org/adblockplus/libadblockplus/EventCallback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld