org.geotools.metadata.iso
Class MetadataEntity

java.lang.Object
  extended byorg.geotools.metadata.iso.MetadataEntity
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
AddressImpl, ApplicationSchemaInformationImpl, BrowseGraphicImpl, CitationDateImpl, CitationImpl, ConstraintsImpl, ContactImpl, ContentInformationImpl, DataQualityImpl, DigitalTransferOptionsImpl, DimensionImpl, DistributionImpl, DistributorImpl, ElementImpl, ExtendedElementInformationImpl, ExtentImpl, FeatureTypeListImpl, FormatImpl, GeographicExtentImpl, GeometricObjectsImpl, IdentificationImpl, IdentifierImpl, KeywordsImpl, LineageImpl, MaintenanceInformationImpl, MediumImpl, MetadataExtensionInformationImpl, MetaDataImpl, OnLineResourceImpl, PortrayalCatalogueReferenceImpl, ProcessStepImpl, RangeDimensionImpl, ResolutionImpl, ResponsiblePartyImpl, ResultImpl, ScopeDescriptionImpl, ScopeImpl, SeriesImpl, SourceImpl, SpatialAttributeSupplementImpl, SpatialRepresentationImpl, StandardOrderProcessImpl, TelephoneImpl, TemporalExtentImpl, UsageImpl, VerticalExtentImpl

public class MetadataEntity
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A superclass for implementing ISO 19115 metadata interfaces. Subclasses must implement at least one of the ISO MetaData interface provided by GeoAPI.

Contract of the clone() method

While cloneable, this class do not provides the clone() operation as part of the public API. The clone operation is required for the internal working of the unmodifiable() method, which expect from clone() a shalow copy of this metadata entity. The default implementation of clone() is suffisient for must uses. However, subclasses are required to overrides the freeze() method.

Since:
2.1
Version:
$Id: MetadataEntity.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Jody Garnett, Martin Desruisseaux
See Also:
Serialized Form

Field Summary
protected static java.util.logging.Logger LOGGER
          The logger for metadata implementation.
 
Constructor Summary
protected MetadataEntity()
          Construct a default metadata entity.
 
Method Summary
protected static void appendLineSeparator(java.lang.StringBuffer buffer)
          Add a line separator to the given buffer, except if the buffer is empty.
protected  void checkWritePermission()
          Check if changes in the metadata are allowed.
protected  java.util.Collection copyCollection(java.util.Collection source, java.util.Collection target, java.lang.Class elementType)
          Copy the content of one collection () into an other ().
protected  void freeze()
          Declare this metadata and all its attributes as unmodifiable.
 boolean isModifiable()
          Returns if this metadata entity is modifiable.
protected  java.util.Collection nonNullCollection(java.util.Collection c, java.lang.Class elementType)
          Returns the specified collection, or a new one if is null.
 MetadataEntity unmodifiable()
          Returns an unmodifiable copy of this metadata.
protected static java.lang.Object unmodifiable(java.lang.Object object)
          Returns an unmodifiable copy of the the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final java.util.logging.Logger LOGGER
The logger for metadata implementation.

Constructor Detail

MetadataEntity

protected MetadataEntity()
Construct a default metadata entity.

Method Detail

isModifiable

public boolean isModifiable()
Returns if this metadata entity is modifiable. This method returns if unmodifiable() has been invoked on this object.


unmodifiable

public MetadataEntity unmodifiable()
Returns an unmodifiable copy of this metadata. Any attempt to modify an attribute of the returned object will throw an UnsupportedOperationException. If this metadata is already unmodifiable, then this method returns .

Returns:
An unmodifiable copy of this metadata.

unmodifiable

protected static java.lang.Object unmodifiable(java.lang.Object object)
Returns an unmodifiable copy of the the specified object. This method is used for implementation of freeze() method by subclasses. This method performs the following heuristic tests:

Parameters:
object - The object to convert in an immutable one.
Returns:
A presumed immutable view of the specified object.

freeze

protected void freeze()
Declare this metadata and all its attributes as unmodifiable. This method is invoked automatically by the unmodifiable() method. Subclasses should overrides this method and invokes unmodifiable(Object) for all attributes.


checkWritePermission

protected void checkWritePermission()
                             throws java.lang.UnsupportedOperationException
Check if changes in the metadata are allowed. All methods in sub-classes should invoke this method before to apply any change.

Throws:
java.lang.UnsupportedOperationException - if this metadata is unmodifiable.

copyCollection

protected final java.util.Collection copyCollection(java.util.Collection source,
                                                    java.util.Collection target,
                                                    java.lang.Class elementType)
Copy the content of one collection () into an other (). If the target collection is , or if its type (List vs Set) doesn't matches the type of the source collection, a new target collection is expected.

Parameters:
source - The source collection.
target - The target collection, or if not yet created.
elementType - The base type of elements to put in the collection.
Returns:
, or a newly created collection.

nonNullCollection

protected final java.util.Collection nonNullCollection(java.util.Collection c,
                                                       java.lang.Class elementType)
Returns the specified collection, or a new one if is null. This is a convenience method for implementation of methods.

Parameters:
c - The collection to checks.
elementType - The element type (used only if is null).
Returns:
, or a new collection if is null.

appendLineSeparator

protected static void appendLineSeparator(java.lang.StringBuffer buffer)
Add a line separator to the given buffer, except if the buffer is empty. This convenience method is used for Object.toString() implementations.



Copyright © GeoTools. All Rights Reserved.