Class AuthorityCodes
- All Implemented Interfaces:
Serializable
,Iterable<String>
,Collection<String>
,Set<String>
A set of EPSG authority codes. This set requires a living connection to the EPSG database. All
iterator()
method call creates a new ResultSet
holding the codes. However, call to contains(java.lang.Object)
map directly to a
SQL call.
Serialization of this class store a copy of all authority codes. The serialization do not preserve any connection to the database.
- Since:
- 2.2
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAuthorityCodes
(TableInfo table, Class<?> type, DirectEpsgFactory factory) Creates a new set of authority codes for the specified type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if this collection contains the specified element.protected void
finalize()
Closes the underlying statements.boolean
isEmpty()
Returnstrue
if this collection contains no elements.iterator()
Returns an iterator over the codes.int
size()
Count the number of elements in the underlying result set.Methods inherited from class AbstractSet
equals, hashCode, removeAll
Methods inherited from class AbstractCollection
add, addAll, clear, containsAll, remove, retainAll, toArray, toArray, toString
Methods inherited from interface Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface Set
add, addAll, clear, containsAll, remove, retainAll, spliterator, toArray, toArray
-
Field Details
-
type
The type for this code set. This is translated to the most appropriate interface type even if the user supplied an implementation type.
-
-
Constructor Details
-
AuthorityCodes
Creates a new set of authority codes for the specified type.- Parameters:
table
- The table to query.type
- The type to query.factory
- The factory originator.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstrue
if this collection contains no elements. This method fetch at most one row instead of counting all rows.- Specified by:
isEmpty
in interfaceCollection<String>
- Specified by:
isEmpty
in interfaceSet<String>
- Overrides:
isEmpty
in classAbstractCollection<String>
-
size
public int size()Count the number of elements in the underlying result set.- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in interfaceSet<String>
- Specified by:
size
in classAbstractCollection<String>
-
contains
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceCollection<String>
- Specified by:
contains
in interfaceSet<String>
- Overrides:
contains
in classAbstractCollection<String>
-
iterator
Returns an iterator over the codes. The iterator is backed by a livingResultSet
, which will be closed as soon as the iterator reach the last element. -
finalize
Closes the underlying statements. Note: this method is also invoked directly byDirectEpsgFactory.dispose()
, which is okay in this particular case since the implementation of this method can be executed an arbitrary amount of times.- Overrides:
finalize
in classObject
- Throws:
SQLException
-