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

com.enonic.xp.suggester.Suggestion Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.suggester;

import java.util.ArrayList;
import java.util.List;

import com.google.common.collect.ImmutableList;

public abstract class Suggestion
{
    private final String name;

    private final List entries;

    protected Suggestion( final Builder builder )
    {
        this.name = builder.name;
        this.entries = ImmutableList.copyOf( builder.suggestionEntries );
    }

    public String getName()
    {
        return name;
    }

    public List getEntries()
    {
        return entries;
    }

    public abstract static class Builder
    {
        private final String name;

        private final List suggestionEntries = new ArrayList<>();

        public Builder( final String name )
        {
            this.name = name;
        }

        @SuppressWarnings("unchecked")
        public T addSuggestionEntry( final ENTRY suggestionEntry )
        {
            this.suggestionEntries.add( suggestionEntry );
            return (T) this;
        }

        public abstract Suggestion build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy