FlagSet.Builder


public final class FlagSet.Builder


A builder for FlagSet instances.

Summary

Public constructors

Creates a builder.

Public methods

FlagSet.Builder

Adds a flag.

FlagSet.Builder

Adds flags.

FlagSet.Builder

Adds flags.

FlagSet.Builder
@CanIgnoreReturnValue
addIf(int flag, boolean condition)

Adds a flag if the provided condition is true.

FlagSet

Builds an FlagSet instance.

FlagSet.Builder

Removes a flag.

FlagSet.Builder

Removes flags.

FlagSet.Builder
@CanIgnoreReturnValue
removeIf(int flag, boolean condition)

Removes a flag if the provided condition is true.

Public constructors

Builder

public Builder()

Creates a builder.

Public methods

add

@CanIgnoreReturnValue
public FlagSet.Builder add(int flag)

Adds a flag.

Parameters
int flag

A flag.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.

addAll

@CanIgnoreReturnValue
public FlagSet.Builder addAll(int[] flags)

Adds flags.

Parameters
int[] flags

The flags to add.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.

addAll

@CanIgnoreReturnValue
public FlagSet.Builder addAll(FlagSet flags)

Adds flags.

Parameters
FlagSet flags

The set of flags to add.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.

addIf

@CanIgnoreReturnValue
public FlagSet.Builder addIf(int flag, boolean condition)

Adds a flag if the provided condition is true. Does nothing otherwise.

Parameters
int flag

A flag.

boolean condition

A condition.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.

build

public FlagSet build()

Builds an FlagSet instance.

Throws
java.lang.IllegalStateException

If this method has already been called.

remove

@CanIgnoreReturnValue
public FlagSet.Builder remove(int flag)

Removes a flag.

Parameters
int flag

A flag.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.

removeAll

@CanIgnoreReturnValue
public FlagSet.Builder removeAll(int[] flags)

Removes flags.

Parameters
int[] flags

The flags to remove.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.

removeIf

@CanIgnoreReturnValue
public FlagSet.Builder removeIf(int flag, boolean condition)

Removes a flag if the provided condition is true. Does nothing otherwise.

Parameters
int flag

A flag.

boolean condition

A condition.

Returns
FlagSet.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called.