11package com .contentstack .sdk ;
22
3+ import lombok .Getter ;
4+ import lombok .Setter ;
35import okhttp3 .ConnectionPool ;
46import org .jetbrains .annotations .NotNull ;
57import org .json .JSONObject ;
@@ -17,6 +19,7 @@ public class Config {
1719 protected String livePreviewHash = null ;
1820 protected String livePreviewContentType = null ;
1921 protected String livePreviewEntryUid = null ;
22+ @ Getter
2023 protected String host = "cdn.contentstack.io" ;
2124 protected String version = "v3" ;
2225 protected String scheme = "https://" ;
@@ -26,38 +29,36 @@ public class Config {
2629 protected JSONObject livePreviewEntry = null ;
2730 protected ContentstackRegion region = ContentstackRegion .US ;
2831 protected String managementToken ;
32+ @ Setter
33+ @ Getter
2934 protected String branch ;
35+ /**
36+ * -- SETTER --
37+ * Proxy can be set like below.
38+ *
39+ * @param proxy Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
40+ * <br>
41+ * <br>
42+ * <b>Example:</b><br>
43+ * <br>
44+ * <code>
45+ * java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
46+ * java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config
47+ * config = new Config(); config.setProxy(proxy);
48+ * </code>
49+ */
50+ @ Setter
3051 protected Proxy proxy = null ;
3152 protected ConnectionPool connectionPool = new ConnectionPool ();
3253
3354 protected List <ContentstackPlugin > plugins = null ;
3455
35- public String getBranch () {
36- return branch ;
37- }
38-
39- public void setBranch (String branch ) {
40- this .branch = branch ;
41- }
42-
4356 /**
44- * Proxy can be set like below.
45- *
46- * @param proxy
47- * Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
48- * <br>
49- * <br>
50- * <b>Example:</b><br>
51- * <br>
52- * <code>
53- * java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
54- * java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config
55- * config = new Config(); config.setProxy(proxy);
56- * </code>
57+ * -- GETTER --
58+ * The configuration for the contentstack that contains support for
5759 */
58- public void setProxy (Proxy proxy ) {
59- this .proxy = proxy ;
60- }
60+ @ Getter
61+ protected String [] earlyAccess ;
6162
6263 /**
6364 * Returns the Proxy instance
@@ -73,12 +74,9 @@ public Proxy getProxy() {
7374 * {@link okhttp3.Address} may share a {@link okhttp3.Connection}. This class implements the policy * of which
7475 * connections to keep open for future use.
7576 *
76- * @param maxIdleConnections
77- * the maxIdleConnections default value is 5
78- * @param keepAliveDuration
79- * the keepAliveDuration default value is 5
80- * @param timeUnit
81- * the timeUnit default value is TimeUnit. MINUTES
77+ * @param maxIdleConnections the maxIdleConnections default value is 5
78+ * @param keepAliveDuration the keepAliveDuration default value is 5
79+ * @param timeUnit the timeUnit default value is TimeUnit. MINUTES
8280 * @return ConnectionPool
8381 */
8482 public ConnectionPool connectionPool (int maxIdleConnections , long keepAliveDuration , TimeUnit timeUnit ) {
@@ -98,8 +96,7 @@ public ContentstackRegion getRegion() {
9896 /**
9997 * Sets region.
10098 *
101- * @param region
102- * the region
99+ * @param region the region
103100 * @return the region
104101 */
105102 public ContentstackRegion setRegion (ContentstackRegion region ) {
@@ -119,20 +116,10 @@ public void setPlugins(List<ContentstackPlugin> plugins) {
119116 this .plugins = plugins ;
120117 }
121118
122- /**
123- * Gets host.
124- *
125- * @return the host
126- */
127- public String getHost () {
128- return host ;
129- }
130-
131119 /**
132120 * Sets host.
133121 *
134- * @param hostName
135- * the host name
122+ * @param hostName the host name
136123 */
137124 public void setHost (String hostName ) {
138125 if (hostName != null && !hostName .isEmpty ()) {
@@ -152,8 +139,7 @@ public String getVersion() {
152139 /**
153140 * Enable live preview config.
154141 *
155- * @param enableLivePreview
156- * to enable live preview
142+ * @param enableLivePreview to enable live preview
157143 * @return the config
158144 */
159145 public Config enableLivePreview (boolean enableLivePreview ) {
@@ -164,8 +150,7 @@ public Config enableLivePreview(boolean enableLivePreview) {
164150 /**
165151 * Sets live preview host.
166152 *
167- * @param livePreviewHost
168- * the live preview host
153+ * @param livePreviewHost the live preview host
169154 * @return the live preview host
170155 */
171156 public Config setLivePreviewHost (@ NotNull String livePreviewHost ) {
@@ -181,8 +166,7 @@ protected Config setLivePreviewEntry(@NotNull JSONObject livePreviewEntry) {
181166 /**
182167 * Sets management token.
183168 *
184- * @param managementToken
185- * the management token
169+ * @param managementToken the management token
186170 * @return the management token
187171 */
188172 public Config setManagementToken (@ NotNull String managementToken ) {
@@ -197,4 +181,23 @@ public enum ContentstackRegion {
197181 US , EU , AZURE_NA , AZURE_EU
198182 }
199183
184+
185+ /**
186+ * The configuration for the contentstack that contains support for Early Access Feature
187+ *
188+ * @param earlyAccessFeatures The list of Early Access Features
189+ * {@code
190+ * Config config = new Config();
191+ * String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
192+ * config.earlyAccess(earlyAccess);
193+ * Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
194+ * <p>
195+ * }
196+ * @return Config
197+ */
198+ public Config earlyAccess (@ NotNull String [] earlyAccessFeatures ) {
199+ this .earlyAccess = earlyAccessFeatures ;
200+ return this ;
201+ }
202+
200203}
0 commit comments