All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.packager.rpm.build.FileInformationProvider Maven / Gradle / Ivy

There is a newer version: 0.21.0
Show newest version
/**
 * Copyright (c) 2015, 2019 Contributors to the Eclipse Foundation
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */

package org.eclipse.packager.rpm.build;

import java.io.IOException;

@FunctionalInterface
public interface FileInformationProvider
{
    public FileInformation provide ( String targetName, T object, PayloadEntryType type ) throws IOException;

    public default FileInformationProvider customize ( final FileInformationCustomizer customizer )
    {
        if ( customizer == null )
        {
            return this;
        }

        return ( targetName, object, type ) -> {
            final FileInformation information = provide ( targetName, object, type );
            customizer.perform ( object, information );
            return information;
        };
    }

    public default FileInformationProvider customize ( final SimpleFileInformationCustomizer customizer )
    {
        if ( customizer == null )
        {
            return this;
        }

        return ( targetName, object, type ) -> {
            final FileInformation information = provide ( targetName, object, type );
            customizer.perform ( information );
            return information;
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy