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

edu.stanford.protege.webprotege.perspective.PerspectiveDetails Maven / Gradle / Ivy

There is a newer version: 2.0.2-WHO
Show newest version
package edu.stanford.protege.webprotege.perspective;

import com.google.auto.value.AutoValue;
import edu.stanford.protege.webprotege.common.LanguageMap;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 2020-09-02
 */
@AutoValue
public abstract class PerspectiveDetails {


    @Nonnull
    public static PerspectiveDetails get(@Nonnull PerspectiveId perspectiveId,
                                         @Nonnull LanguageMap label,
                                         boolean favorite,
                                         @Nullable Node layout) {
        return new AutoValue_PerspectiveDetails(perspectiveId, label, favorite, layout);
    }

    @Nonnull
    public abstract PerspectiveId getPerspectiveId();

    @Nonnull
    public abstract LanguageMap getLabel();

    public abstract boolean isFavorite();

    @Nullable
    protected abstract Node getLayoutInternal();

    @Nonnull
    public Optional getLayout() {
        return Optional.ofNullable(getLayoutInternal());
    }

    public PerspectiveDescriptor toPerspectiveDescriptor() {
        return PerspectiveDescriptor.get(getPerspectiveId(),
                                         getLabel(),
                                         isFavorite());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy