mirage-config/docs/mirage/config/ConfigDictionary.get.html

202 lines
7.1 KiB
HTML
Raw Normal View History

2022-10-09 00:10:05 +02:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/>
<title>ConfigDictionary.get - multiple declarations</title>
<link rel="stylesheet" href="../../css/style.min.css"/>
<script type="text/javascript" src="../../js/script.min.js"></script>
</head>
<body onload="setupDdox();">
<header></header>
<nav id="main-nav">
<div>
<noscript>
<p style="color: red">The search functionality needs JavaScript enabled</p>
</noscript>
<div id="symbolSearchPane" style="display: none">
<form action="#" method="GET">
<input id="symbolSearch" type="text" name="q" placeholder="Search for symbols" autocomplete="off" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" autofocus/>
</form>
<ul id="symbolSearchResults" class="symbolList" style="display: none"></ul><script type="application/javascript" src="../../symbols.js"></script><script type="application/javascript">var symbolSearchRootDir = "../../";
document.getElementById('symbolSearchPane').style.display = 'block';</script>
</div>
<ul class="tree-view">
<li class="tree-view ">
<div class="package ">
<a href="../../mirage.html">mirage</a>
</div>
<ul class="tree-view">
<li>
<div class="module selected">
<a href="../../mirage/config.html">config</a>
</div>
</li>
<li>
<div class="module ">
<a href="../../mirage/java.html">java</a>
</div>
</li>
<li>
<div class="module ">
<a href="../../mirage/json.html">json</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
<p id="main-nav-footer">
Built with
<a href="https://github.com/MartinNowak/scod">scod</a>
</p>
</nav>
<div id="main-contents">
<div>
<h1>ConfigDictionary.get - multiple declarations</h1>
<nav class="page-nav">
<ul>
<li>
<a href="#0">
Function <code>ConfigDictionary.get</code>
</a>
</li>
<li>
<a href="#1">
Function <code>ConfigDictionary.get</code>
</a>
</li>
<li>
<a href="#2">
Function <code>ConfigDictionary.get</code>
</a>
</li>
</ul>
</nav><h2 id="0">Function ConfigDictionary.get</h2><p>Get values from the configuration using config path notation.
</p>
<div class="prototype">
<code class="lang-d">
<div class="single-prototype">
<span class="typ">string</span> <span class="pln">get</span>
<span class="pun">(</span>
<br/>
&nbsp;&nbsp;<span class="typ">string</span> <span class="pln">configPath</span><span class="pun">,</span>
<br/>
&nbsp;&nbsp;<span class="typ">string</span> <span class="pln">defaultValue</span> <span class="pun">=</span> <span class="kwd">null</span>
<br/>
<span class="pun">)</span><span class="pun">;</span>
</div>
</code>
</div>
<section></section>
<section><h3>Parameters</h3>
<table><col class="caption"><tr><th>Name</th><th>Description</th></tr>
<tr><td id="configPath">configPath</td><td> Path to the wanted config value. The path is separated by dots, e.g. "server.public.hostname".
Values from arrays can be selected by brackets, for example: "server[3].hostname.ports[0]".
When the config is just a value, for example just a string, it can be fetched by just specifying "." as path.
Although the path should be universally the same over all types of config files, some might not lend to this structure,
and have a more specific way of retrieving data from the config. See the examples and specific config factories for
more details.</td></tr>
<tr><td id="defaultValue">defaultValue</td><td> (Optional) Value to return when the given configPath is invalid. When not supplied a ConfigPathNotFoundException exception is thrown.</td></tr>
</table>
</section>
<section><h3>Throws</h3>
<p>ConfigReadException when something goes wrong reading the config.
ConfigPathNotFoundException when the given path does not exist in the config.
</p>
</section>
<section><h3>Returns</h3>
<p>The value at the path in the configuration. To convert it use get!T().
</p>
</section>
<h2 id="1">Function ConfigDictionary.get</h2><p>Get values from the configuration and attempts to convert them to the specified type.
</p>
<div class="prototype">
<code class="lang-d">
<div class="single-prototype">
<span class="typ">ConvertToType</span> <span class="pln">get</span>(ConvertToType)
<span class="pun">(</span>
<br/>
&nbsp;&nbsp;<span class="typ">string</span> <span class="pln">configPath</span>
<br/>
<span class="pun">)</span><span class="pun">;</span>
</div>
</code>
</div>
<section></section>
<section><h3>Parameters</h3>
<table><col class="caption"><tr><th>Name</th><th>Description</th></tr>
<tr><td id="configPath">configPath</td><td> Path to the wanted config value. See get().</td></tr>
</table>
</section>
<section><h3>Throws</h3>
<p>ConfigReadException when something goes wrong reading the config.
ConfigPathNotFoundException when the given path does not exist in the config.
</p>
</section>
<section><h3>Returns</h3>
<p>The value at the path in the configuration.
</p>
</section>
<section><h3>See Also</h3>
<p>get
</p>
</section>
<h2 id="2">Function ConfigDictionary.get</h2><p>Get values from the configuration and attempts to convert them to the specified type.
</p>
<div class="prototype">
<code class="lang-d">
<div class="single-prototype">
<span class="typ">ConvertToType</span> <span class="pln">get</span>(ConvertToType)
<span class="pun">(</span>
<br/>
&nbsp;&nbsp;<span class="typ">string</span> <span class="pln">configPath</span><span class="pun">,</span>
<br/>
&nbsp;&nbsp;<span class="typ">ConvertToType</span> <span class="pln">defaultValue</span>
<br/>
<span class="pun">)</span><span class="pun">;</span>
</div>
</code>
</div>
<section></section>
<section><h3>Parameters</h3>
<table><col class="caption"><tr><th>Name</th><th>Description</th></tr>
<tr><td id="configPath">configPath</td><td> Path to the wanted config value. See get().</td></tr>
<tr><td id="defaultValue">defaultValue</td><td> (Optional) Value to return when the given configPath is invalid. When not supplied a ConfigPathNotFoundException exception is thrown.</td></tr>
</table>
</section>
<section><h3>Throws</h3>
<p>ConfigReadException when something goes wrong reading the config.
ConfigPathNotFoundException when the given path does not exist in the config.
</p>
</section>
<section><h3>Returns</h3>
<p>The value at the path in the configuration.
</p>
</section>
<section><h3>See Also</h3>
<p>get
</p>
</section>
</div>
<footer>
<div id="license-info">
<p>Mike Bierlee, m.bierlee@lostmoment.com
</p>
<p>2022 Mike Bierlee
</p>
<p>This software is licensed under the terms of the MIT license.
The full terms of the license can be found in the LICENSE file.
</p>
</div>
</footer>
</div>
</body>
</html>