blob: 357155f1f658cc2ff1a8de0b8732914c8d49a5e2 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 -->
<title>FeatureNaming (Apache SIS 1.4 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-10-05">
<meta name="description" content="declaration: module: org.apache.sis.storage, package: org.apache.sis.storage, class: FeatureNaming">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.storage.FeatureNaming class">
<meta name="keywords" content="get()">
<meta name="keywords" content="add()">
<meta name="keywords" content="remove()">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../../../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
<ul class="sub-nav-list-small">
<li>
<p>Summary:</p>
<ul>
<li>Nested</li>
<li>Field</li>
<li><a href="#constructor-summary">Constr</a></li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</li>
<li><a href="#constructor-detail">Constr</a></li>
<li><a href="#method-detail">Method</a></li>
</ul>
</li>
</ul>
</div>
<div class="sub-nav">
<div id="navbar-sub-list">
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a>
<input type="text" id="search-input" disabled placeholder="Search">
<input type="reset" id="reset-button" disabled value="reset">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="module-label-in-type">Module</span>&nbsp;<a href="../../../../module-summary.html">org.apache.sis.storage</a></div>
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.storage</a></div>
<h1 title="Class FeatureNaming" class="title">Class FeatureNaming&lt;E&gt;</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
<div class="inheritance">FeatureNaming&lt;E&gt;</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>E</code> - the type of elements associated with the names.</dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">FeatureNaming&lt;E&gt;</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">Helper class for mapping <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/GenericName.html" title="class or interface in org.opengis.util" class="external-link"><code>Generic­Name</code></a> instances and their shortened names to features.
The features are typically represented by instances of <code>Feature­Type</code>
or <code>Coverage</code> (sometimes seen as a kind of features), but this class
actually puts no restriction on the kind of object associated to <code>Generic­Name</code>s;
<a href="DataStore.html" title="class in org.apache.sis.storage"><code>Data­Store</code></a> implementations are free to choose their internal object.
Those objects can be stored and fetched using the <code>String</code> representation of their name
as given by <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/GenericName.html#toString()" title="class or interface in org.opengis.util" class="external-link"><code>Generic­Name​.to­String()</code></a>, or a shortened name when there is no ambiguity.
Note that search is case sensitive.
<h2 id="example-heading">Example</h2>
a data store may contain a <code>Feature­Type</code> named <code>"foo:bar"</code>.
If that feature type has been binded like below:
<div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button>
<pre class="snippet"><code class="language-java">FeatureNaming&lt;FeatureType&gt; binding = new FeatureNaming&lt;&gt;();
FeatureType myFooBar = ...; // Some type named "foo:bar" for this example.
binding.add(null, myFooBar.getName(), myFooBar);
</code></pre>
</div>
Then the two following lines return the same instance:
<div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button>
<pre class="snippet"><code class="language-java">assert binding.get(null, "foo:bar") == myFooBar;
assert binding.get(null, "bar") == myFooBar; // Allowed only if there is no ambiguity.
</code></pre>
</div>
Note that contrarily to the standard <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html#get(java.lang.Object)" title="class or interface in java.util" class="external-link"><code>Map​.get(Object)</code></a> method contract, the <a href="#get(org.apache.sis.storage.DataStore,java.lang.String)"><code>get(…)</code></a>
method defined in this class throws an exception instead of returning <code>null</code> if no unambiguous mapping
can be established for the given name. This behavior allows <code>Feature­Naming</code> to produce an error message
telling why the operation cannot succeed.
<h2 id="managing-the-list-of-generic-names-heading">Managing the list of generic names</h2>
This class does not memorize the list of <a href="#add(org.apache.sis.storage.DataStore,org.opengis.util.GenericName,E)">added</a> <code>Generic­Name</code> instances. Instead, this
class memorizes only their string representations, thus protecting the binding from any change in the original
<code>Generic­Name</code> instances. The list of feature names should instead be included in the ISO 19115 metadata
returned by <a href="DataStore.html#getMetadata()"><code>Data­Store​.get­Metadata()</code></a>. The path to feature names is:
<blockquote><code>metadata</code> /
<a href="../../../../../org.apache.sis.metadata/org/apache/sis/metadata/iso/DefaultMetadata.html#getContentInfo()"><code>content­Info</code></a> /
<a href="../../../../../org.apache.sis.metadata/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.html#getFeatureTypeInfo()"><code>feature­Types</code></a> /
<a href="../../../../../org.apache.sis.metadata/org/apache/sis/metadata/iso/content/DefaultFeatureTypeInfo.html#getFeatureTypeName()"><code>feature­Type­Name</code></a>
</blockquote>
Note that above metadata information are not necessarily structured as a flat list; a <code>Data­Store</code> may group
some feature information in different <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/metadata/content/FeatureCatalogueDescription.html" title="class or interface in org.opengis.metadata.content" class="external-link"><code>Feature­Catalogue­Description</code></a> instances.
This is one reason why we let the data store manages <code>Generic­Name</code> lists itself.
<h2 id="thread-safety-heading">Thread safety</h2>
A <code>Feature­Naming</code> instance is thread-safe only if constructed once and never modified after publication.
For example, it is safe to initialize a <code>Feature­Naming</code> in a <a href="DataStore.html" title="class in org.apache.sis.storage"><code>Data­Store</code></a> or <a href="DataStoreProvider.html" title="class in org.apache.sis.storage"><code>Data­Store­Provider</code></a>
constructor if the result is stored in a private final field with no public accessor
and no call to <a href="#add(org.apache.sis.storage.DataStore,org.opengis.util.GenericName,E)"><code>add(…)</code></a> or <a href="#remove(org.apache.sis.storage.DataStore,org.opengis.util.GenericName)"><code>remove(…)</code></a> methods after construction.
If this condition does not hold, then synchronization (if desired) is caller's responsibility.
The caller is typically the <code>Data­Store</code> implementation which contains this <code>Feature­Naming</code> instance.</div>
<dl class="notes">
<dt>Since:</dt>
<dd>0.8</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../../org.apache.sis.metadata/org/apache/sis/util/iso/AbstractName.html" title="class in org.apache.sis.util.iso"><code>Abstract­Name</code></a></li>
<li><a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/DefaultFeatureType.html" title="class in org.apache.sis.feature"><code>Default­Feature­Type</code></a></li>
<li><a href="../../../../../org.apache.sis.metadata/org/apache/sis/metadata/iso/content/DefaultFeatureTypeInfo.html" title="class in org.apache.sis.metadata.iso.content"><code>Default­Feature­Type­Info</code></a></li>
</ul>
</dd>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">Feature­Naming</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a new "<code>Generic­Name</code> to object" mapping.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#add(org.apache.sis.storage.DataStore,org.opengis.util.GenericName,E)" class="member-name-link">add</a><wbr>(<a href="DataStore.html" title="class in org.apache.sis.storage">Data­Store</a>&nbsp;store,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/GenericName.html" title="class or interface in org.opengis.util" class="external-link">Generic­Name</a>&nbsp;name,
<a href="FeatureNaming.html" title="type parameter in FeatureNaming">E</a>&nbsp;value)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Adds a value for the given name if none exist.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="FeatureNaming.html" title="type parameter in FeatureNaming">E</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#get(org.apache.sis.storage.DataStore,java.lang.String)" class="member-name-link">get</a><wbr>(<a href="DataStore.html" title="class in org.apache.sis.storage">Data­Store</a>&nbsp;store,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the value associated to the given name (case sensitive).</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#remove(org.apache.sis.storage.DataStore,org.opengis.util.GenericName)" class="member-name-link">remove</a><wbr>(<a href="DataStore.html" title="class in org.apache.sis.storage">Data­Store</a>&nbsp;store,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/GenericName.html" title="class or interface in org.opengis.util" class="external-link">Generic­Name</a>&nbsp;name)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Removes the value associated to the given name.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">get­Class</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hash­Code</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notify­All</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">to­String</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>FeatureNaming</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">FeatureNaming</span>()</div>
<div class="block">Creates a new "<code>Generic­Name</code> to object" mapping.</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="get(org.apache.sis.storage.DataStore,java.lang.String)">
<h3>get</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="FeatureNaming.html" title="type parameter in FeatureNaming">E</a></span>&nbsp;<span class="element-name">get</span><wbr><span class="parameters">(<a href="DataStore.html" title="class in org.apache.sis.storage">DataStore</a>&nbsp;store,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name)</span>
throws <span class="exceptions"><a href="IllegalNameException.html" title="class in org.apache.sis.storage">IllegalNameException</a></span></div>
<div class="block">Returns the value associated to the given name (case sensitive).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>store</code> - the data store for which to get a value, or <code>null</code> if unknown.</dd>
<dd><code>name</code> - the name for which to get a value.</dd>
<dt>Returns:</dt>
<dd>value associated to the given object.</dd>
<dt>Throws:</dt>
<dd><code><a href="IllegalNameException.html" title="class in org.apache.sis.storage">Illegal­Name­Exception</a></code> - if the given name was not found or is ambiguous.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="add(org.apache.sis.storage.DataStore,org.opengis.util.GenericName,E)">
<h3 id="add(org.apache.sis.storage.DataStore,org.opengis.util.GenericName,java.lang.Object)">add</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">add</span><wbr><span class="parameters">(<a href="DataStore.html" title="class in org.apache.sis.storage">DataStore</a>&nbsp;store,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/GenericName.html" title="class or interface in org.opengis.util" class="external-link">GenericName</a>&nbsp;name,
<a href="FeatureNaming.html" title="type parameter in FeatureNaming">E</a>&nbsp;value)</span>
throws <span class="exceptions"><a href="IllegalNameException.html" title="class in org.apache.sis.storage">IllegalNameException</a></span></div>
<div class="block">Adds a value for the given name if none exist.
If a previous value already exists for the given name, then an exception is thrown.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>store</code> - the data store for which to add a value, or <code>null</code> if unknown.</dd>
<dd><code>name</code> - the name for which to add a value.</dd>
<dd><code>value</code> - the value to add (cannot be null).</dd>
<dt>Throws:</dt>
<dd><code><a href="IllegalNameException.html" title="class in org.apache.sis.storage">Illegal­Name­Exception</a></code> - if another element is already registered for the given name.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="remove(org.apache.sis.storage.DataStore,org.opengis.util.GenericName)">
<h3>remove</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">remove</span><wbr><span class="parameters">(<a href="DataStore.html" title="class in org.apache.sis.storage">DataStore</a>&nbsp;store,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/GenericName.html" title="class or interface in org.opengis.util" class="external-link">GenericName</a>&nbsp;name)</span>
throws <span class="exceptions"><a href="IllegalNameException.html" title="class in org.apache.sis.storage">IllegalNameException</a></span></div>
<div class="block">Removes the value associated to the given name.
If no value is associated to the given name, then this method does nothing.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>store</code> - the data store for which to remove a value, or <code>null</code> if unknown.</dd>
<dd><code>name</code> - the name for which to remove value.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the value was removed, or <code>false</code> if no value was defined for the given name.</dd>
<dt>Throws:</dt>
<dd><code><a href="IllegalNameException.html" title="class in org.apache.sis.storage">Illegal­Name­Exception</a></code> - if inconsistency are found between the given name and the one which was given
to the <a href="#add(org.apache.sis.storage.DataStore,org.opengis.util.GenericName,E)"><code>add(…)</code></a> method. An example of inconsistency is a name having the same string
representation, but for which <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/ScopedName.html#tail()" title="class or interface in org.opengis.util" class="external-link"><code>Scoped­Name​.tail()</code></a> returns different values.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>