Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultScope.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultScope.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultScope.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultScope.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -80,12 +80,34 @@ public class DefaultScope extends ISOMet } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(Scope) + */ + public DefaultScope(final Scope object) { + super(object); + level = object.getLevel(); + extent = object.getExtent(); + levelDescription = copyCollection(object.getLevelDescription(), ScopeDescription.class); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultScope}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultScope} instance is created using the + * {@linkplain #DefaultScope(Scope) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -95,9 +117,7 @@ public class DefaultScope extends ISOMet if (object == null || object instanceof DefaultScope) { return (DefaultScope) object; } - final DefaultScope copy = new DefaultScope(); - copy.shallowCopy(object); - return copy; + return new DefaultScope(object); } /**
Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalConsistency.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalConsistency.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalConsistency.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalConsistency.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -45,12 +45,31 @@ public class DefaultTemporalConsistency } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(TemporalConsistency) + */ + public DefaultTemporalConsistency(final TemporalConsistency object) { + super(object); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultTemporalConsistency}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultTemporalConsistency} instance is created using the + * {@linkplain #DefaultTemporalConsistency(TemporalConsistency) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -60,8 +79,6 @@ public class DefaultTemporalConsistency if (object == null || object instanceof DefaultTemporalConsistency) { return (DefaultTemporalConsistency) object; } - final DefaultTemporalConsistency copy = new DefaultTemporalConsistency(); - copy.shallowCopy(object); - return copy; + return new DefaultTemporalConsistency(object); } } Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalValidity.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalValidity.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalValidity.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTemporalValidity.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -45,12 +45,31 @@ public class DefaultTemporalValidity ext } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(TemporalValidity) + */ + public DefaultTemporalValidity(final TemporalValidity object) { + super(object); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultTemporalValidity}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultTemporalValidity} instance is created using the + * {@linkplain #DefaultTemporalValidity(TemporalValidity) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -60,8 +79,6 @@ public class DefaultTemporalValidity ext if (object == null || object instanceof DefaultTemporalValidity) { return (DefaultTemporalValidity) object; } - final DefaultTemporalValidity copy = new DefaultTemporalValidity(); - copy.shallowCopy(object); - return copy; + return new DefaultTemporalValidity(object); } } Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultThematicClassificationCorrectness.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultThematicClassificationCorrectness.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultThematicClassificationCorrectness.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultThematicClassificationCorrectness.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -47,12 +47,31 @@ public class DefaultThematicClassificati } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(ThematicClassificationCorrectness) + */ + public DefaultThematicClassificationCorrectness(final ThematicClassificationCorrectness object) { + super(object); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultThematicClassificationCorrectness}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultThematicClassificationCorrectness} instance is created using the + * {@linkplain #DefaultThematicClassificationCorrectness(ThematicClassificationCorrectness) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -62,8 +81,6 @@ public class DefaultThematicClassificati if (object == null || object instanceof DefaultThematicClassificationCorrectness) { return (DefaultThematicClassificationCorrectness) object; } - final DefaultThematicClassificationCorrectness copy = new DefaultThematicClassificationCorrectness(); - copy.shallowCopy(object); - return copy; + return new DefaultThematicClassificationCorrectness(object); } } Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTopologicalConsistency.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTopologicalConsistency.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTopologicalConsistency.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultTopologicalConsistency.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -48,12 +48,31 @@ public class DefaultTopologicalConsisten } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(TopologicalConsistency) + */ + public DefaultTopologicalConsistency(final TopologicalConsistency object) { + super(object); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultTopologicalConsistency}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultTopologicalConsistency} instance is created using the + * {@linkplain #DefaultTopologicalConsistency(TopologicalConsistency) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -63,8 +82,6 @@ public class DefaultTopologicalConsisten if (object == null || object instanceof DefaultTopologicalConsistency) { return (DefaultTopologicalConsistency) object; } - final DefaultTopologicalConsistency copy = new DefaultTopologicalConsistency(); - copy.shallowCopy(object); - return copy; + return new DefaultTopologicalConsistency(object); } } Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsability.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsability.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsability.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsability.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -46,12 +46,31 @@ public class DefaultUsability extends Ab } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(Usability) + */ + public DefaultUsability(final Usability object) { + super(object); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultUsability}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultUsability} instance is created using the + * {@linkplain #DefaultUsability(Usability) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -61,8 +80,6 @@ public class DefaultUsability extends Ab if (object == null || object instanceof DefaultUsability) { return (DefaultUsability) object; } - final DefaultUsability copy = new DefaultUsability(); - copy.shallowCopy(object); - return copy; + return new DefaultUsability(object); } } Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractGeolocationInformation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractGeolocationInformation.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractGeolocationInformation.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractGeolocationInformation.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -58,15 +58,34 @@ public class AbstractGeolocationInformat } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. * - * <p>This method checks for the {@link GCPCollection} sub-interface. If that interface is - * found, then this method delegates to the corresponding {@code castOrCopy} static method.</p> + * @param object The metadata to copy values from. + * + * @see #castOrCopy(GeolocationInformation) + */ + public AbstractGeolocationInformation(final GeolocationInformation object) { + super(object); + qualityInfo = copyCollection(object.getQualityInfo(), DataQuality.class); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is is an instance of {@link GCPCollection}, then this method + * delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.</li> + * <li>Otherwise if the given object is already an instance of + * {@code AbstractGeolocationInformation}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code AbstractGeolocationInformation} instance is created using the + * {@linkplain #AbstractGeolocationInformation(GeolocationInformation) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -76,12 +95,11 @@ public class AbstractGeolocationInformat if (object instanceof GCPCollection) { return DefaultGCPCollection.castOrCopy((GCPCollection) object); } + // Intentionally tested after the sub-interfaces. if (object == null || object instanceof AbstractGeolocationInformation) { return (AbstractGeolocationInformation) object; } - final AbstractGeolocationInformation copy = new AbstractGeolocationInformation(); - copy.shallowCopy(object); - return copy; + return new AbstractGeolocationInformation(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractSpatialRepresentation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractSpatialRepresentation.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractSpatialRepresentation.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/AbstractSpatialRepresentation.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -54,18 +54,36 @@ public class AbstractSpatialRepresentati } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. * - * <p>This method checks for the {@link GridSpatialRepresentation} and {@link VectorSpatialRepresentation} - * sub-interfaces. If one of those interfaces is found, then this method delegates to - * the corresponding {@code castOrCopy} static method. If the given object implements more - * than one of the above-cited interfaces, then the {@code castOrCopy} method to be used is - * unspecified.</p> + * @param object The metadata to copy values from. + * + * @see #castOrCopy(SpatialRepresentation) + */ + public AbstractSpatialRepresentation(final SpatialRepresentation object) { + super(object); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is is an instance of {@link VectorSpatialRepresentation} or + * {@link GridSpatialRepresentation}, then this method delegates to the {@code castOrCopy(…)} + * method of the corresponding SIS subclass. Note that if the given object implements + * more than one of the above-cited interfaces, then the {@code castOrCopy(…)} method + * to be used is unspecified.</li> + * <li>Otherwise if the given object is already an instance of + * {@code AbstractSpatialRepresentation}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code AbstractSpatialRepresentation} instance is created using the + * {@linkplain #AbstractSpatialRepresentation(SpatialRepresentation) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -78,11 +96,10 @@ public class AbstractSpatialRepresentati if (object instanceof VectorSpatialRepresentation) { return DefaultVectorSpatialRepresentation.castOrCopy((VectorSpatialRepresentation) object); } + // Intentionally tested after the sub-interfaces. if (object == null || object instanceof AbstractSpatialRepresentation) { return (AbstractSpatialRepresentation) object; } - final AbstractSpatialRepresentation copy = new AbstractSpatialRepresentation(); - copy.shallowCopy(object); - return copy; + return new AbstractSpatialRepresentation(object); } } Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -82,12 +82,34 @@ public class DefaultDimension extends IS } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(Dimension) + */ + public DefaultDimension(final Dimension object) { + super(object); + dimensionName = object.getDimensionName(); + dimensionSize = object.getDimensionSize(); + resolution = object.getResolution(); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultDimension}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultDimension} instance is created using the + * {@linkplain #DefaultDimension(Dimension) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -97,9 +119,7 @@ public class DefaultDimension extends IS if (object == null || object instanceof DefaultDimension) { return (DefaultDimension) object; } - final DefaultDimension copy = new DefaultDimension(); - copy.shallowCopy(object); - return copy; + return new DefaultDimension(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCP.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCP.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCP.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCP.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -64,12 +64,33 @@ public class DefaultGCP extends ISOMetad } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(GCP) + */ + public DefaultGCP(final GCP object) { + super(object); + accuracyReports = copyCollection(object.getAccuracyReports(), Element.class); + geographicCoordinates = object.getGeographicCoordinates(); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultGCP}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultGCP} instance is created using the + * {@linkplain #DefaultGCP(GCP) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -79,9 +100,7 @@ public class DefaultGCP extends ISOMetad if (object == null || object instanceof DefaultGCP) { return (DefaultGCP) object; } - final DefaultGCP copy = new DefaultGCP(); - copy.shallowCopy(object); - return copy; + return new DefaultGCP(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCPCollection.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCPCollection.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCPCollection.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGCPCollection.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -76,12 +76,35 @@ public class DefaultGCPCollection extend } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(GCPCollection) + */ + public DefaultGCPCollection(final GCPCollection object) { + super(object); + collectionIdentification = object.getCollectionIdentification(); + collectionName = object.getCollectionName(); + coordinateReferenceSystem = object.getCoordinateReferenceSystem(); + GCPs = copyCollection(object.getGCPs(), GCP.class); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultGCPCollection}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultGCPCollection} instance is created using the + * {@linkplain #DefaultGCPCollection(GCPCollection) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -91,9 +114,7 @@ public class DefaultGCPCollection extend if (object == null || object instanceof DefaultGCPCollection) { return (DefaultGCPCollection) object; } - final DefaultGCPCollection copy = new DefaultGCPCollection(); - copy.shallowCopy(object); - return copy; + return new DefaultGCPCollection(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeometricObjects.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeometricObjects.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeometricObjects.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeometricObjects.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -73,12 +73,33 @@ public class DefaultGeometricObjects ext } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(GeometricObjects) + */ + public DefaultGeometricObjects(final GeometricObjects object) { + super(object); + geometricObjectType = object.getGeometricObjectType(); + geometricObjectCount = object.getGeometricObjectCount(); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultGeometricObjects}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultGeometricObjects} instance is created using the + * {@linkplain #DefaultGeometricObjects(GeometricObjects) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -88,9 +109,7 @@ public class DefaultGeometricObjects ext if (object == null || object instanceof DefaultGeometricObjects) { return (DefaultGeometricObjects) object; } - final DefaultGeometricObjects copy = new DefaultGeometricObjects(); - copy.shallowCopy(object); - return copy; + return new DefaultGeometricObjects(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -115,12 +115,39 @@ public class DefaultGeorectified extends } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(Georectified) + */ + public DefaultGeorectified(final Georectified object) { + super(object); + checkPointAvailable = object.isCheckPointAvailable(); + checkPointDescription = object.getCheckPointDescription(); + cornerPoints = copyList(object.getCornerPoints(), Point.class); + centerPoint = object.getCenterPoint(); + pointInPixel = object.getPointInPixel(); + transformationDimensionDescription = object.getTransformationDimensionDescription(); + transformationDimensionMapping = copyCollection(object.getTransformationDimensionMapping(), InternationalString.class); + checkPoints = copyCollection(object.getCheckPoints(), GCP.class); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultGeorectified}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultGeorectified} instance is created using the + * {@linkplain #DefaultGeorectified(Georectified) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -130,9 +157,7 @@ public class DefaultGeorectified extends if (object == null || object instanceof DefaultGeorectified) { return (DefaultGeorectified) object; } - final DefaultGeorectified copy = new DefaultGeorectified(); - copy.shallowCopy(object); - return copy; + return new DefaultGeorectified(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -93,12 +93,37 @@ public class DefaultGeoreferenceable ext } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(Georeferenceable) + */ + public DefaultGeoreferenceable(final Georeferenceable object) { + super(object); + controlPointAvailable = object.isControlPointAvailable(); + orientationParameterAvailable = object.isOrientationParameterAvailable(); + orientationParameterDescription = object.getOrientationParameterDescription(); + parameterCitations = copyCollection(object.getParameterCitations(), Citation.class); + geolocationInformation = copyCollection(object.getGeolocationInformation(), GeolocationInformation.class); + georeferencedParameters = object.getGeoreferencedParameters(); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultGeoreferenceable}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultGeoreferenceable} instance is created using the + * {@linkplain #DefaultGeoreferenceable(Georeferenceable) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -108,9 +133,7 @@ public class DefaultGeoreferenceable ext if (object == null || object instanceof DefaultGeoreferenceable) { return (DefaultGeoreferenceable) object; } - final DefaultGeoreferenceable copy = new DefaultGeoreferenceable(); - copy.shallowCopy(object); - return copy; + return new DefaultGeoreferenceable(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -85,18 +85,40 @@ public class DefaultGridSpatialRepresent } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). - * - * <p>This method checks for the {@link Georectified} and {@link Georeferenceable} - * sub-interfaces. If one of those interfaces is found, then this method delegates to - * the corresponding {@code castOrCopy} static method. If the given object implements more - * than one of the above-cited interfaces, then the {@code castOrCopy} method to be used is - * unspecified.</p> + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(GridSpatialRepresentation) + */ + public DefaultGridSpatialRepresentation(final GridSpatialRepresentation object) { + super(object); + numberOfDimensions = object.getNumberOfDimensions(); + axisDimensionProperties = copyList(object.getAxisDimensionProperties(), Dimension.class); + cellGeometry = object.getCellGeometry(); + transformationParameterAvailable = object.isTransformationParameterAvailable(); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is is an instance of {@link Georectified} or + * {@link Georeferenceable}, then this method delegates to the {@code castOrCopy(…)} + * method of the corresponding SIS subclass. Note that if the given object implements + * more than one of the above-cited interfaces, then the {@code castOrCopy(…)} method + * to be used is unspecified.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultGridSpatialRepresentation}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultGridSpatialRepresentation} instance is created using the + * {@linkplain #DefaultGridSpatialRepresentation(GridSpatialRepresentation) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -109,12 +131,11 @@ public class DefaultGridSpatialRepresent if (object instanceof Georeferenceable) { return DefaultGeoreferenceable.castOrCopy((Georeferenceable) object); } + // Intentionally tested after the sub-interfaces. if (object == null || object instanceof DefaultGridSpatialRepresentation) { return (DefaultGridSpatialRepresentation) object; } - final DefaultGridSpatialRepresentation copy = new DefaultGridSpatialRepresentation(); - copy.shallowCopy(object); - return copy; + return new DefaultGridSpatialRepresentation(object); } /** Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultVectorSpatialRepresentation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultVectorSpatialRepresentation.java?rev=1462152&r1=1462151&r2=1462152&view=diff ============================================================================== --- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultVectorSpatialRepresentation.java [UTF-8] (original) +++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultVectorSpatialRepresentation.java [UTF-8] Thu Mar 28 15:25:51 2013 @@ -65,12 +65,33 @@ public class DefaultVectorSpatialReprese } /** - * Returns a SIS metadata implementation with the same values than the given arbitrary - * implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is - * returned unchanged. Otherwise a new SIS implementation is created and initialized to the - * property values of the given object, using a <cite>shallow</cite> copy operation - * (i.e. properties are not cloned). + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from. + * + * @see #castOrCopy(VectorSpatialRepresentation) + */ + public DefaultVectorSpatialRepresentation(final VectorSpatialRepresentation object) { + super(object); + topologyLevel = object.getTopologyLevel(); + geometricObjects = copyCollection(object.getGeometricObjects(), GeometricObjects.class); + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable actions in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of + * {@code DefaultVectorSpatialRepresentation}, then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultVectorSpatialRepresentation} instance is created using the + * {@linkplain #DefaultVectorSpatialRepresentation(VectorSpatialRepresentation) copy constructor} + * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other + * metadata contained in the given object are not recursively copied.</li> + * </ul> * * @param object The object to get as a SIS implementation, or {@code null} if none. * @return A SIS implementation containing the values of the given object (may be the @@ -80,9 +101,7 @@ public class DefaultVectorSpatialReprese if (object == null || object instanceof DefaultVectorSpatialRepresentation) { return (DefaultVectorSpatialRepresentation) object; } - final DefaultVectorSpatialRepresentation copy = new DefaultVectorSpatialRepresentation(); - copy.shallowCopy(object); - return copy; + return new DefaultVectorSpatialRepresentation(object); } /**
