com.enonic.xp.schema.mixin.MixinNames Maven / Gradle / Ivy
package com.enonic.xp.schema.mixin;
import java.util.Arrays;
import java.util.Collection;
import com.google.common.collect.ImmutableList;
import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.support.AbstractImmutableEntityList;
@PublicApi
public final class MixinNames
extends AbstractImmutableEntityList
{
private MixinNames( final ImmutableList list )
{
super( list );
}
public static MixinNames empty()
{
return new MixinNames( ImmutableList.of() );
}
public static MixinNames from( final String... mixinNames )
{
return new MixinNames( parseQualifiedNames( mixinNames ) );
}
public static MixinNames from( final Collection mixinNames )
{
return from( mixinNames.toArray( new String[0] ) );
}
public static MixinNames from( final MixinName... mixinNames )
{
return new MixinNames( ImmutableList.copyOf( mixinNames ) );
}
public static MixinNames from( final Iterable mixinNames )
{
return new MixinNames( ImmutableList.copyOf( mixinNames ) );
}
private static ImmutableList parseQualifiedNames( final String... mixinNames )
{
return Arrays.stream( mixinNames ).map( MixinName::from ).collect( ImmutableList.toImmutableList() );
}
}