com.enonic.xp.vacuum.VacuumParameters Maven / Gradle / Ivy
package com.enonic.xp.vacuum;
import java.time.Duration;
import java.util.Collection;
import com.google.common.collect.ImmutableSet;
public class VacuumParameters
{
private final VacuumListener vacuumListener;
private final Duration ageThreshold;
private final ImmutableSet taskNames;
private VacuumParameters( final Builder builder )
{
this.vacuumListener = builder.vacuumListener;
this.ageThreshold = builder.ageThreshold == null ? null : builder.ageThreshold;
this.taskNames = builder.taskNames == null ? null : ImmutableSet.copyOf( builder.taskNames );
}
public static Builder create()
{
return new Builder();
}
public VacuumListener getVacuumListener()
{
return vacuumListener;
}
public Duration getAgeThreshold()
{
return ageThreshold;
}
public ImmutableSet getTaskNames()
{
return taskNames;
}
public static final class Builder
{
private VacuumListener vacuumListener;
private Duration ageThreshold;
private Collection taskNames;
private Builder()
{
}
public Builder vacuumListener( final VacuumListener vacuumListener )
{
this.vacuumListener = vacuumListener;
return this;
}
public Builder ageThreshold( final Duration ageThreshold )
{
this.ageThreshold = ageThreshold;
return this;
}
public Builder taskNames( final Collection taskNames )
{
this.taskNames = taskNames;
return this;
}
public VacuumParameters build()
{
return new VacuumParameters( this );
}
}
}