http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/a61cb5e3/content/site/apidocs/overview-summary.html
----------------------------------------------------------------------
diff --git a/content/site/apidocs/overview-summary.html
b/content/site/apidocs/overview-summary.html
index 50b7e28..b8ebb43 100644
--- a/content/site/apidocs/overview-summary.html
+++ b/content/site/apidocs/overview-summary.html
@@ -1725,14 +1725,14 @@
<cc># Default section</cc>
<ck>key1</ck> = <cv>1</cv>
<ck>key2</ck> = <cv>true</cv>
- <ck>key3</ck> = <cv>1,2,3</cv>
+ <ck>key3</ck> = <cv>[1,2,3]</cv>
<ck>key4</ck> = <cv>http://foo</cv>
<cc># Section 1</cc>
<cs>[Section1]</cs>
<ck>key1</ck> = <cv>2</cv>
<ck>key2</ck> = <cv>false</cv>
- <ck>key3</ck> = <cv>4,5,6</cv>
+ <ck>key3</ck> = <cv>[4,5,6]</cv>
<ck>key4</ck> = <cv>http://bar</cv>
</p>
<p>
@@ -1745,7 +1745,7 @@
URL key4;
<jc>// Load our config file</jc>
- ConfigFile f = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyIniFile.cfg"</js>);
+ ConfigFile f = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyConfig.cfg"</js>);
<jc>// Read values from default section</jc>
key1 = f.getInt(<js>"key1"</js>);
@@ -1764,12 +1764,12 @@
</p>
<p class='bcode'>
<jc>// Construct the sample INI file programmatically</jc>
- ConfigFile cf = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyIniFile.cfg"</js>)
+ ConfigFile cf = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyConfig.cfg"</js>)
.addLines(<jk>null</jk>,
<js>"# Default section"</js>,
<js>"key1 = 1"</js>,
<js>"key2 = true"</js>,
- <js>"key3 = 1,2,3"</js>,
+ <js>"key3 = [1,2,3]"</js>,
<js>"key4 = http://foo"</js>,
<js>""</js>)
.addHeaderComments(<js>"Section1"</js>,
@@ -1777,7 +1777,7 @@
.addLines(<js>"Section1"</js>,
<js>"key1 = 2"</js>,
<js>"key2 = false"</js>,
- <js>"key3 = 4,5,6"</js>,
+ <js>"key3 = [4,5,6]"</js>,
<js>"key4 = http://bar"</js>)
.save();
</p>
@@ -1786,7 +1786,7 @@
</p>
<p class='bcode'>
<jc>// Construct the sample INI file programmatically</jc>
- ConfigFile cf = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyIniFile.cfg"</js>)
+ ConfigFile cf = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyConfig.cfg"</js>)
.addLines(<jk>null</jk>,
<js>"# Default section"</js>)
.addHeaderComments(<js>"section1"</js>,
@@ -1802,11 +1802,14 @@
cf.save();
</p>
<p>
+ Values are LAX JSON (i.e. unquoted attributes, single quotes) except
for top-level strings which are left unquoted.
+ Any parsable object types are supported as values (e.g. arrays,
collections, beans, swappable objects, enums, etc...).
+ </p>
+ <p>
The config file looks deceptively simple, the config file API is a
very powerful feature with many capabilities, including:
</p>
<ul class='spaced-list'>
<li>The ability to use variables to reference environment variables,
system properties, other config file entries, and a host of other types.
- <li>The ability to store and retrieve POJOs as JSON.
<li>APIs for updating, modifying, and saving configuration files
without losing comments or formatting.
<li>Extensive listener APIs.
</ul>
@@ -1824,7 +1827,7 @@
<ck>aBoolean</ck> = <cv>true</cv>
<cc># An int array</cc>
- <ck>anIntArray</ck> = <cv>1,2,3</cv>
+ <ck>anIntArray</ck> = <cv>[1,2,3]</cv>
<cc># A POJO that can be converted from a String</cc>
<ck>aURL</ck> = <cv>http://foo </cv>
@@ -1873,6 +1876,75 @@
String myArg = cf.getString(<js>"MySection/myArg"</js>);
String firstArg = cf.getString(<js>"MySection/firstArg"</js>);
</p>
+ <p>
+ Config files can also be used to directly populate beans using the <a
href="org/apache/juneau/ini/ConfigFile.html#getSectionAsBean-java.lang.String-java.lang.Class-boolean-"><code>ConfigFile.getSectionAsBean(String,Class,boolean)</code></a>:
+ </p>
+ <p class='bcode'>
+ <jc>// Example config file</jc>
+ <cs>[MyAddress]</cs>
+ <ck>name</ck> = <cv>John Smith</cv>
+ <ck>street</ck> = <cv>123 Main Street</cv>
+ <ck>city</ck> = <cv>Anywhere</cv>
+ <ck>state</ck> = <cv>NY</cv>
+ <ck>zip</ck> = <cv>12345</cv>
+
+ <jc>// Example bean</jc>
+ <jk>public class</jk> Address {
+ public String name, street, city;
+ public StateEnum state;
+ public int zip;
+ }
+
+ <jc>// Example usage</jc>
+ ConfigFile cf = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyConfig.cfg"</js>);
+ Address myAddress = cf.getSectionAsBean(<js>"MySection"</js>,
Address.<jk>class</jk>);
+ </p>
+ <p>
+ Config file sections can also be accessed via interface proxies using
<a
href="org/apache/juneau/ini/ConfigFile.html#getSectionAsInterface-java.lang.String-java.lang.Class-"><code>ConfigFile.getSectionAsInterface(String,Class)</code></a>:
+ </p>
+ <p class='bcode'>
+ <jc>// Example config file</jc>
+ <cs>[MySection]</cs>
+ <ck>string</ck> = <cv>foo</cv>
+ <ck>int</ck> = <cv>123</cv>
+ <ck>enum</ck> = <cv>ONE</cv>
+ <ck>bean</ck> = <cv>{foo:'bar',baz:123}</cv>
+ <ck>int3dArray</ck> = <cv>[[[123,null],null],null]</cv>
+ <ck>bean1d3dListMap</ck> = <cv>{key:[[[[{foo:'bar',baz:123}]]]]}</cv>
+
+ <jc>// Example interface</jc>
+ <jk>public interface</jk> MyConfigInterface {
+
+ String getString();
+ <jk>void</jk> setString(String x);
+
+ <jk>int</jk> getInt();
+ <jk>void</jk> setInt(<jk>int</jk> x);
+
+ MyEnum getEnum();
+ <jk>void</jk> setEnum(MyEnum x);
+
+ MyBean getBean();
+ <jk>void</jk> setBean(MyBean x);
+
+ <jk>int</jk>[][][] getInt3dArray();
+ <jk>void</jk> setInt3dArray(<jk>int</jk>[][][] x);
+
+ Map<String,List<MyBean[][][]>> getBean1d3dListMap();
+ <jk>void</jk>
setBean1d3dListMap(Map<String,List<MyBean[][][]>> x);
+ }
+
+ <jc>// Example usage</jc>
+ ConfigFile cf = <jk>new</jk>
ConfigFileBuilder().build(<js>"MyConfig.cfg"</js>);
+ MyConfigInterface ci = cf.getSectionAsInterface(<js>"MySection"</js>,
MyConfigInterface.<jk>class</jk>);
+ <jk>int</jk> myInt = ci.getInt();
+ ci.setBean(<jk>new</jk> MyBean());
+ cf.save();
+ </p>
+
+
+
+
<h6 class='topic'>Additional Information</h6>
<ul class='javahierarchy'>
@@ -6325,6 +6397,23 @@
<li>New package: <a
href="org/apache/juneau/http/package-summary.html"><code>org.apache.juneau.http</code></a>.
<li>Support for dynamic beans. See <a
href="org/apache/juneau/annotation/BeanProperty.html#name--"><code>@BeanProperty.name()</code></a>.
<li>New doc: <a class='doclink' href='#Core.JacksonComparison'>2.12 -
Comparison with Jackson</a>
+ <li>All parsers now allow for numeric types with
<js>'K'</js>/<js>'M'</js>/<js>'G'</js> suffixes to represent
+ kilobytes, megabytes, and gigabytes.
+ <p class='bcode'>
+ <jc>// Example</jc>
+ <jk>int</jk> i = JsonParser.<jsf>DEFAULT</jsf>.parse(<js>"123M"</js>);
<jc>// 123MB</jc>
+ </p>
+ <li>New/modified methods on <a
href="org/apache/juneau/ini/ConfigFile.html" title="class in
org.apache.juneau.ini"><code>ConfigFile</code></a>:
+ <ul>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#put-java.lang.String-java.lang.String-java.lang.Object-boolean-"><code>put(String,String,Object,boolean)</code></a>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#getObject-java.lang.String-java.lang.reflect.Type-java.lang.reflect.Type...-"><code>getObject(String,Type,Type...)</code></a>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#getObject-java.lang.String-java.lang.Class-"><code>getObject(String,Class)</code></a>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#getObject-java.lang.String-java.lang.String-java.lang.reflect.Type-java.lang.reflect.Type...-"><code>getObject(String,String,Type,Type...)</code></a>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#getObject-java.lang.String-java.lang.String-java.lang.Class-"><code>getObject(String,String,Class)</code></a>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#getObjectWithDefault-java.lang.String-T-java.lang.reflect.Type-java.lang.reflect.Type...-"><code>getObjectWithDefault(String,Object,Type,Type)</code></a>
+ <li><a
href="org/apache/juneau/ini/ConfigFile.html#getObjectWithDefault-java.lang.String-T-java.lang.Class-"><code>getObjectWithDefault(String,Object,Class)</code></a>
+ </ul>
+ <li>New ability to interact with config file sections with proxy
interfaces with new method <a
href="org/apache/juneau/ini/ConfigFile.html#getSectionAsInterface-java.lang.String-java.lang.Class-"><code>ConfigFile.getSectionAsInterface(String,Class)</code></a>.
</ul>
<h6 class='topic'>org.apache.juneau.rest</h6>