|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractSet org.geotools.referencing.factory.IdentifiedObjectSet
A lazy set of identified objects. This set creates
IdentifiedObject
s from authority codes only when first needed. This class
is typically used as the set returned by implementations of the
createFromCoordinateReferenceSystemCodes
method. Deferred creation in this case may
have great performance impact since a set may contains about 40 entries (e.g.
transformations from "ED50" (EPSG:4230) to "WGS 84" (EPSG:4326)) while some users
only want to look for the first entry (e.g. the default
AuthorityBackedFactory
implementation).
NoSuchIdentifierException
), the exception is logged with
the FINE
level (because this is a recoverable failure) and
the iteration continue. If the operation creation failed for any other kind of
reason (FactoryException
), then the exception is rethrown as an unchecked
BackingStoreException
. This default behavior can be changed if a subclass
overrides the isRecoverableFailure
method.
Field Summary | |
protected org.opengis.referencing.AuthorityFactory |
factory
The factory to use for creating identified objects when first needed. |
Constructor Summary | |
IdentifiedObjectSet(org.opengis.referencing.AuthorityFactory factory)
Creates an initially empty set. |
Method Summary | |
boolean |
add(java.lang.Object object)
Ensures that this collection contains the specified object. |
boolean |
addAuthorityCode(java.lang.String code)
Ensures that this collection contains an object for the specified authority code. |
void |
clear()
Removes all of the elements from this collection. |
boolean |
contains(java.lang.Object object)
Returns if this collection contains the specified object. |
protected org.opengis.referencing.IdentifiedObject |
createObject(java.lang.String code)
Creates an object for the specified authority code. |
protected java.lang.String |
getAuthorityCode(org.opengis.referencing.IdentifiedObject object)
Returns the code to uses as a key for the specified object. |
java.lang.String[] |
getAuthorityCodes()
Returns the authority code of all objects in this set. |
protected boolean |
isRecoverableFailure(org.opengis.referencing.FactoryException exception)
Returns if the specified exception should be handled as a recoverable failure. |
java.util.Iterator |
iterator()
Returns an iterator over the objects in this set. |
boolean |
remove(java.lang.Object object)
Removes a single instance of the specified element from this collection, if it is present. |
boolean |
removeAll(java.util.Collection collection)
Removes from this collection all of its elements that are contained in the specified collection. |
void |
resolve(int n)
Ensures that the n first objects in this set are created. |
void |
setAuthorityCodes(java.lang.String[] codes)
Set the content of this set as an array of authority codes. |
int |
size()
Returns the number of objects available in this set. |
protected java.lang.Object |
writeReplace()
Returns a serializable copy of this set. |
Methods inherited from class java.util.AbstractSet |
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, containsAll, isEmpty, retainAll, toArray, toArray |
Field Detail |
protected final org.opengis.referencing.AuthorityFactory factory
Constructor Detail |
public IdentifiedObjectSet(org.opengis.referencing.AuthorityFactory factory)
factory
- The factory to use for deferred IdentifiedObject
s creations.Method Detail |
public void clear()
clear
in interface java.util.Set
public int size()
size
in interface java.util.Set
public boolean addAuthorityCode(java.lang.String code)
public boolean add(java.lang.Object object)
add
in interface java.util.Set
public boolean contains(java.lang.Object object)
contains
in interface java.util.Set
public boolean remove(java.lang.Object object)
remove
in interface java.util.Set
public boolean removeAll(java.util.Collection collection)
removeAll
in interface java.util.Set
public java.util.Iterator iterator()
FactoryException
other than NoSuchIdentifierException
, then
the exception will be rethrown as an unchecked BackingStoreException
.
iterator
in interface java.util.Set
public void resolve(int n) throws org.opengis.referencing.FactoryException
addAuthorityCode(java.lang.String)
in order to make sure
that the underlying factory is really capable to create at least
one object. FactoryException
(except the ones accepted as
recoverable failures) are thrown as if they were never
wrapped into BackingStoreException
.
n
- The number of object to resolve. If this number is equals or greater than the
set's size, then the creation of all objects is garantee
successful.
org.opengis.referencing.FactoryException
- if an object creation failed.public java.lang.String[] getAuthorityCodes()
This method is typically used together with setAuthorityCodes(java.lang.String[])
for altering the
iteration order on the basis of authority codes.
public void setAuthorityCodes(java.lang.String[] codes)
This method is typically used together with getAuthorityCodes()
for altering the
iteration order on the basis of authority codes. If the specified array
contains the same elements than getAuthorityCodes()
in a different order, then
this method just set the new ordering.
addAuthorityCode(java.lang.String)
protected java.lang.String getAuthorityCode(org.opengis.referencing.IdentifiedObject object)
protected org.opengis.referencing.IdentifiedObject createObject(java.lang.String code) throws org.opengis.referencing.FactoryException
factory.createObject
(code)
.
Subclasses may override this method if they want to invoke a more specific method.
org.opengis.referencing.FactoryException
protected boolean isRecoverableFailure(org.opengis.referencing.FactoryException exception)
FINE
level. If this method returns , then the
exception will be retrown as a BackingStoreException
. The default implementation
returns only for NoSuchIdentifierException
(not to be confused with
NoSuchAuthorityCodeException
).
protected java.lang.Object writeReplace() throws java.io.ObjectStreamException
java.io.ObjectStreamException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |