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

com.enonic.xp.repository.IndexDefinitions Maven / Gradle / Ivy

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

import java.util.Map;

import com.google.common.collect.ImmutableMap;

import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.index.IndexType;

@PublicApi
public class IndexDefinitions
{
    private final Map configs;

    private IndexDefinitions( final Builder builder )
    {
        this.configs = builder.configs.build();
    }

    public static Builder create()
    {
        return new Builder();
    }

    public IndexDefinition get( final IndexType indexType )
    {
        return configs.get( indexType );
    }

    public static final class Builder
    {
        private final ImmutableMap.Builder configs = ImmutableMap.builder();

        private Builder()
        {
        }

        public Builder add( final IndexType type, final IndexDefinition config )
        {
            this.configs.put( type, config );
            return this;
        }

        public IndexDefinitions build()
        {
            return new IndexDefinitions( this );
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy