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

edu.stanford.protege.webprotege.app.ApplicationPortSupplier Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.app;

import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.Optional;
import java.util.function.Supplier;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 19 Mar 2017
 */
public class ApplicationPortSupplier implements Supplier> {

    private final ApplicationPreferencesStore manager;

    @Inject
    public ApplicationPortSupplier(@Nonnull ApplicationPreferencesStore manager) {
        this.manager = checkNotNull(manager);
    }

    public Optional get() {
        int port = manager.getApplicationPreferences().getApplicationLocation().getPort();
        if(port != 0) {
            return Optional.of(
                    port
            );
        }
        else {
            return Optional.empty();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy