/** * 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, or {@code null} if none. * * @see #castOrCopy(FeatureCatalogueDescription) */ public DefaultFeatureCatalogueDescription(final FeatureCatalogueDescription object) { super(object); if (object != null) { compliant = object.isCompliant(); includedWithDataset = object.isIncludedWithDataset(); languages = copyCollection(object.getLanguages(), Locale.class); featureCatalogueCitations = copyCollection(object.getFeatureCatalogueCitations(), Citation.class); if (object instanceof DefaultFeatureCatalogueDescription) { featureTypes = copyCollection(((DefaultFeatureCatalogueDescription) object).getFeatureTypeInfo(), DefaultFeatureTypeInfo.class); } else { setFeatureTypes(object.getFeatureTypes()); } } }
/** * 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, or {@code null} if none. * * @see #castOrCopy(FeatureCatalogueDescription) */ public DefaultFeatureCatalogueDescription(final FeatureCatalogueDescription object) { super(object); if (object != null) { compliant = object.isCompliant(); includedWithDataset = object.isIncludedWithDataset(); languages = copyCollection(object.getLanguages(), Locale.class); featureCatalogueCitations = copyCollection(object.getFeatureCatalogueCitations(), Citation.class); if (object instanceof DefaultFeatureCatalogueDescription) { featureTypes = copyCollection(((DefaultFeatureCatalogueDescription) object).getFeatureTypeInfo(), DefaultFeatureTypeInfo.class); } else { setFeatureTypes(object.getFeatureTypes()); } } }
/** * Verifies that the given metadata contains only bounds information * and the hard-coded list of feature types. */ private static void verifyAlmostEmptyMetadata(final Metadata md) { assertNull("name", md.name); assertNull("description", md.description); assertNull("time", md.time); assertNull("keywords", md.keywords); assertBoundsEquals(-20, 30, 10, 40, md.bounds); assertNull("author", md.author); assertNull("copyright", md.copyright); assertNull("links", md.links); /* * Verifies the list of feature types declared in the given metadata. Those features * are not listed in GPX files; they are rather hard-coded in Types.metadata constant. */ final FeatureCatalogueDescription content = (FeatureCatalogueDescription) getSingleton(md.getContentInfo()); assertTrue("isIncludedWithDataset", content.isIncludedWithDataset()); final Iterator<? extends GenericName> it = content.getFeatureTypes().iterator(); assertStringEquals("Route", it.next().tip()); assertStringEquals("Track", it.next().tip()); assertStringEquals("WayPoint", it.next().tip()); assertFalse("hasNext", it.hasNext()); }