blob: c627702b9b16fa70fb2853d24262c7d3b770cccc [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
Primitive Types
<p>
The most common case for configuration values are primitives.
</p>
<p class='bpcode w800'>
<cc># A string</cc>
<ck>key1</ck> = <cv>foo</cv>
<cc># A boolean</cc>
<ck>key2</ck> = <cv>true</cv>
<cc># An integer</cc>
<ck>key3</ck> = <cv>123</cv>
<cc># A long</cc>
<ck>key4</ck> = <cv>10000000000</cv>
<cc># Doubles</cc>
<ck>key5</ck> = <cv>6.67e−11</cv>
<ck>key6</ck> = <cv>Infinity</cv>
</p>
<p>
The following methods are provided for accessing primitive values:
</p>
<ul class='javatree'>
<li class='jc'>{@link oaj.config.Config}
<ul>
<li class='jm'>{@link oaj.config.Config#getString(String) getString(String)}
<li class='jm'>{@link oaj.config.Config#getString(String,String) getString(String,String)}
<li class='jm'>{@link oaj.config.Config#getBoolean(String) getBoolean(String)}
<li class='jm'>{@link oaj.config.Config#getBoolean(String,boolean) getBoolean(String,boolean)}
<li class='jm'>{@link oaj.config.Config#getInt(String) getInt(String)}
<li class='jm'>{@link oaj.config.Config#getInt(String,int) getInt(String,int)}
<li class='jm'>{@link oaj.config.Config#getLong(String) getLong(String)}
<li class='jm'>{@link oaj.config.Config#getLong(String,long) getLong(String,long)}
<li class='jm'>{@link oaj.config.Config#getFloat(String) getFloat(String)}
<li class='jm'>{@link oaj.config.Config#getFloat(String,float) getFloat(String,long)}
<li class='jm'>{@link oaj.config.Config#getDouble(String) getDouble(String)}
<li class='jm'>{@link oaj.config.Config#getDouble(String,double) getDouble(String,long)}
</ul>
</ul>
<p>
On integers and longs, <js>"K"</js>, <js>"M"</js>, and <js>"G"</js> can be used to identify kilo, mega, and giga.
</p>
<p class='bpcode w800'>
<ck>key1</ck> = <cv>100K</cv> <cc># Same as 1024000</cc>
<ck>key2</ck> = <cv>100M</cv> <cc># Same as 104857600</cc>
</p>
<p>
Numbers can also use hexadecimal and octal notation:
</p>
<p class='bpcode w800'>
<ck>hex1</ck> = <cv>0x12FE</cv>
<ck>hex2</ck> = <cv>0X12FE</cv>
<ck>octal1</ck> = <cv>01234</cv>
</p>
<p>
Strings with newlines are treated as multi-line values that get broken into separate lines:
</p>
<p class='bpcode w800'>
<ck>key1</ck> = <cv>This is a particularly long sentence that we want to split</cv>
<cv>onto separate lines</cv>.
</p>
<p>
Typically, multi-line values are started on the next line for clarity like so:
</p>
<p class='bpcode w800'>
<ck>key1</ck> =
<cv>This is a particularly long sentence that we want to split</cv>
<cv>onto separate lines</cv>.
</p>