thredds.catalog2.builder.util.MetadataBuilderUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdm Show documentation
Show all versions of cdm Show documentation
The NetCDF-Java Library is a Java interface to NetCDF files,
as well as to many other types of scientific data formats.
The newest version!
package thredds.catalog2.builder.util;
import thredds.catalog2.builder.MetadataBuilder;
import thredds.catalog2.builder.ThreddsBuilderFactory;
/**
* Utility methods for copying MetadataBuilder
s.
*
* @author edavis
* @since 4.0
*/
public class MetadataBuilderUtils
{
private MetadataBuilderUtils() {}
public static MetadataBuilder copyIntoNewMetadataBuilder( MetadataBuilder source,
ThreddsBuilderFactory builderFactory )
{
if ( source == null )
throw new IllegalArgumentException( "Source builder may not be null." );
if ( builderFactory == null )
throw new IllegalArgumentException( "Builder factory may not be null.");
MetadataBuilder result = builderFactory.newMetadataBuilder();
copyMetadataBuilder( source, result );
return result;
}
public static MetadataBuilder copyMetadataBuilder( MetadataBuilder source,
MetadataBuilder recipient )
{
if ( source == null )
throw new IllegalArgumentException( "Source builder may not be null.");
if ( recipient == null )
throw new IllegalArgumentException( "Recipient builder may not be null.");
recipient.setContainedContent( source.isContainedContent() );
if ( source.isContainedContent())
recipient.setContent( source.getContent() );
else
{
recipient.setTitle( source.getTitle() );
recipient.setExternalReference( source.getExternalReference() );
}
return recipient;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy