public final class AuthorityCodes extends AbstractSet<String> implements Serializable
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.
Modifier and Type | Field and Description |
---|---|
Class<?> |
type
The type for this code set.
|
Constructor and Description |
---|
AuthorityCodes(TableInfo table,
Class<?> type,
DirectEpsgFactory factory)
Creates a new set of authority codes for the specified type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Object code)
Returns
true if this collection contains the specified element. |
protected void |
finalize()
Closes the underlying statements.
|
boolean |
isEmpty()
Returns
true if this collection contains no elements. |
Iterator<String> |
iterator()
Returns an iterator over the codes.
|
int |
size()
Count the number of elements in the underlying result set.
|
protected PreparedStatement |
validateStatement(PreparedStatement stmt,
String sql) |
protected Object |
writeReplace()
Returns a serializable copy of this set.
|
equals, hashCode, removeAll
add, addAll, clear, containsAll, remove, retainAll, toArray, toArray, toString
add, addAll, clear, containsAll, remove, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public final Class<?> type
public AuthorityCodes(TableInfo table, Class<?> type, DirectEpsgFactory factory)
connection
- The provider of connection to the EPSG database.table
- The table to query.type
- The type to query.factory
- The factory originator.protected PreparedStatement validateStatement(PreparedStatement stmt, String sql) throws SQLException
SQLException
public boolean isEmpty()
true
if this collection contains no elements. This method fetch at most one
row instead of counting all rows.isEmpty
in interface Collection<String>
isEmpty
in interface Set<String>
isEmpty
in class AbstractCollection<String>
public int size()
size
in interface Collection<String>
size
in interface Set<String>
size
in class AbstractCollection<String>
public boolean contains(Object code)
true
if this collection contains the specified element.contains
in interface Collection<String>
contains
in interface Set<String>
contains
in class AbstractCollection<String>
public Iterator<String> iterator()
ResultSet
,
which will be closed as soon as the iterator reach the last element.protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
protected void finalize() throws SQLException
DirectEpsgFactory.dispose()
, which is okay in this particular case since the implementation of
this method can be executed an arbitrary amount of times.finalize
in class Object
SQLException
Copyright © 1996–2019 Geotools. All rights reserved.