com.enonic.xp.macro.MacroDescriptors Maven / Gradle / Ivy
The newest version!
package com.enonic.xp.macro;
import java.util.Collection;
import com.google.common.collect.ImmutableSet;
import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.support.AbstractImmutableEntitySet;
@PublicApi
public final class MacroDescriptors
extends AbstractImmutableEntitySet
{
private MacroDescriptors( final ImmutableSet list )
{
super( list );
}
public static MacroDescriptors from( final MacroDescriptor... macroDescriptors )
{
return new MacroDescriptors( ImmutableSet.copyOf( macroDescriptors ) );
}
public static MacroDescriptors from( final Collection macroDescriptors )
{
return new MacroDescriptors( ImmutableSet.copyOf( macroDescriptors ) );
}
public static MacroDescriptors from( final Iterable... macroDescriptors )
{
final ImmutableSet.Builder keys = ImmutableSet.builder();
for ( Iterable keysParam : macroDescriptors )
{
keys.addAll( keysParam );
}
return new MacroDescriptors( keys.build() );
}
public static MacroDescriptors empty()
{
return new MacroDescriptors( ImmutableSet.of() );
}
}