Package: FileEntityGeoTrackProviderRoleFactory
FileEntityGeoTrackProviderRoleFactory
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
createRoleFor(FileEntity) |
|
|
|
|
|
Coverage
1: package it.tidalwave.geo.impl;
2:
3: import jakarta.annotation.Nonnull;
4: import java.util.Optional;
5: import it.tidalwave.dam.model.io.FileEntity;
6: import it.tidalwave.geo.GeoTrack;
7: import it.tidalwave.geo.GeoTrackProvider;
8: import it.tidalwave.util.RoleFactory;
9: import it.tidalwave.dci.annotation.DciRole;
10: import lombok.RequiredArgsConstructor;
11:
12: /***************************************************************************************************************************************************************
13: *
14: * A {@link RoleFactory} that conditionally provides the {@link GeoTrackProvider} role to {@link FileEntity} instances associated to track files.
15: *
16: * @see GeoTrackProvider
17: * @see FileEntityGeoTrackProvider
18: * @author Fabrizio Giudici
19: *
20: **************************************************************************************************************************************************************/
21: @DciRole(datumType = FileEntity.class) @RequiredArgsConstructor
22: public class FileEntityGeoTrackProviderRoleFactory implements RoleFactory<FileEntity, GeoTrackProvider>
23: {
24: @Override @Nonnull
25: public Optional<GeoTrackProvider> createRoleFor (@Nonnull final FileEntity file)
26: {
27:• return GeoTrack.getSupportedExtensions().contains(file.getLcExtension()) ? Optional.of(new FileEntityGeoTrackProvider(file)) : Optional.empty();
28: }
29: }