use of org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo in project sis by apache.
the class MetadataBuilder method addFeatureType.
/**
* Adds descriptions for the given feature.
* Storage location is:
*
* <ul>
* <li>{@code metadata/contentInfo/featureTypes/featureTypeName}</li>
* <li>{@code metadata/contentInfo/featureTypes/featureInstanceCount}</li>
* </ul>
*
* This method returns the feature name for more convenient chaining with
* {@link org.apache.sis.storage.FeatureNaming#add FeatureNaming.add(…)}.
* Note that the {@link FeatureCatalogBuilder} subclasses can also be used for that chaining.
*
* @param type the feature type to add, or {@code null} for no-operation.
* @param occurrences number of instances of the given feature type, or {@code null} if unknown.
* @return the name of the added feature, or {@code null} if none.
*
* @see FeatureCatalogBuilder#define(DefaultFeatureType)
*/
public final GenericName addFeatureType(final DefaultFeatureType type, final Integer occurrences) {
if (type != null) {
final GenericName name = type.getName();
if (name != null) {
final DefaultFeatureTypeInfo info = new DefaultFeatureTypeInfo(name);
if (occurrences != null) {
info.setFeatureInstanceCount(shared(occurrences));
}
addIfNotPresent(featureDescription().getFeatureTypeInfo(), info);
return name;
}
}
return null;
}
Aggregations