protected <D extends FileDescriptor> D getOrCreateAs(String path, Class<D> type, Function<String, FileDescriptor> existing, ScannerContext context) {
        FileDescriptor descriptor = cache.get(path, p -> {
            FileDescriptor fileDescriptor = existing.apply(p);
            if (fileDescriptor != null) {
                return fileDescriptor;
            }
            fileDescriptor = context.getStore().create(type);
            fileDescriptor.setFileName(path);
            return fileDescriptor;
        });
        return migrateOrCast(descriptor, type, context);
    }
protected <D extends FileDescriptor> D getOrCreateAs(String path, Class<D> type, Function<String, FileDescriptor> existing, ScannerContext context) {
        FileDescriptor descriptor = cache.get(path, p -> {
            FileDescriptor fileDescriptor = existing.apply(p);
            if (fileDescriptor != null) {
                return fileDescriptor;
            }
            fileDescriptor = context.getStore().create(type);
            fileDescriptor.setFileName(path);
            return fileDescriptor;
        });
        return migrateOrCast(descriptor, type, context);
    }
protected < D extends FileDescriptor > D getOrCreateAs ( String path , Class < D > type , Function < String , FileDescriptor > existing , ScannerContext context ) { FileDescriptor descriptor = cache . get ( path , p -> { FileDescriptor fileDescriptor = existing . apply ( p ) ; if ( fileDescriptor != null ) { return fileDescriptor ; } fileDescriptor = context . getStore ( ) . create ( type ) ; fileDescriptor . setFileName ( path ) ; return fileDescriptor ; } ) ; return migrateOrCast ( descriptor , type , context ) ; }
Get an existing {@link FileDescriptor} or create a new one. If an existing
{@link FileDescriptor} exists it will be migrated on demand.

@param path
The path.
@param type
The requested type.
@param existing
A {@link Function} to resolve an existing {@link FileDescriptor}.
@param context
The {@link ScannerContext}.
@param <D>
The requested type.
@return The {@link FileDescriptor}.
Get an existing { @link FileDescriptor } or create a new one . If an existing { @link FileDescriptor } exists it will be migrated on demand .