com.enonic.xp.suggester.Suggestion Maven / Gradle / Ivy
The 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();
}
}