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

com.enonic.xp.security.IdProviderKeys Maven / Gradle / Ivy

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

import java.util.List;
import java.util.stream.Stream;

import com.google.common.collect.ImmutableList;

import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.support.AbstractImmutableEntityList;

import static java.util.stream.Collectors.toList;

@PublicApi
public final class IdProviderKeys
    extends AbstractImmutableEntityList
{
    private IdProviderKeys( final ImmutableList list )
    {
        super( list );
    }

    public static IdProviderKeys from( final IdProviderKey... idProviderKeys )
    {
        return new IdProviderKeys( ImmutableList.copyOf( idProviderKeys ) );
    }

    public static IdProviderKeys from( final Iterable idProviderKeys )
    {
        return new IdProviderKeys( ImmutableList.copyOf( idProviderKeys ) );
    }

    public static IdProviderKeys from( final String... idProviderKeys )
    {
        return new IdProviderKeys( parseIdProviderKeys( idProviderKeys ) );
    }

    public static IdProviderKeys empty()
    {
        return new IdProviderKeys( ImmutableList.of() );
    }

    private static ImmutableList parseIdProviderKeys( final String... idProviderKeys )
    {
        final List idProviderKeyList = Stream.of( idProviderKeys ).map( IdProviderKey::new ).collect( toList() );
        return ImmutableList.copyOf( idProviderKeyList );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy