/** * Creates the distribution information object if it does not already exists, then returns it. * * @return the distribution information (never {@code null}). * @see #newDistribution() */ private DefaultDistribution distribution() { if (distribution == null) { distribution = new DefaultDistribution(); } return distribution; }
/** * Creates the distribution information object if it does not already exists, then returns it. * * @return the distribution information (never {@code null}). * @see #newDistribution() */ private DefaultDistribution distribution() { if (distribution == null) { distribution = new DefaultDistribution(); } return distribution; }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action 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 DefaultDistribution}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultDistribution} instance is created using the * {@linkplain #DefaultDistribution(Distribution) 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 * given object itself), or {@code null} if the argument was null. */ public static DefaultDistribution castOrCopy(final Distribution object) { if (object == null || object instanceof DefaultDistribution) { return (DefaultDistribution) object; } return new DefaultDistribution(object); }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action 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 DefaultDistribution}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultDistribution} instance is created using the * {@linkplain #DefaultDistribution(Distribution) 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 * given object itself), or {@code null} if the argument was null. */ public static DefaultDistribution castOrCopy(final Distribution object) { if (object == null || object instanceof DefaultDistribution) { return (DefaultDistribution) object; } return new DefaultDistribution(object); }
/** * Creates the metadata object corresponding to the {@link #JSON} string. */ static DefaultMetadata createMetadata() { final AbstractIdentification identification = new AbstractIdentification(); identification.setCitation(new DefaultCitation("Data \"title\"")); identification.setExtents(singleton(new DefaultExtent(null, new DefaultGeographicBoundingBox(-11.4865013, -4.615912, 43.165467, 49.9990223), null, null))); final DefaultDistribution distribution = new DefaultDistribution(); distribution.setDistributors(asList( new DefaultDistributor(new DefaultResponsibility(Role.AUTHOR, null, null)), new DefaultDistributor(new DefaultResponsibility(Role.COLLABORATOR, null, null)))); final DefaultMetadata metadata = new DefaultMetadata(); metadata.setFileIdentifier("An archive"); metadata.setLanguage(Locale.ENGLISH); metadata.setCharacterSets(singleton(StandardCharsets.UTF_8)); metadata.setMetadataStandardName("ISO19115"); metadata.setMetadataStandardVersion("2003/Cor.1:2006"); metadata.setIdentificationInfo(singleton(identification)); metadata.setDistributionInfo(singleton(distribution)); return metadata; }
final DefaultDistribution distributionInfo = new DefaultDistribution(); distributor.setRole(Role.DISTRIBUTOR); distributionInfo.setDistributors(singleton(new DefaultDistributor(distributor)));