Class FlagSet.Builder

  • Enclosing class:
    FlagSet

    public static final class FlagSet.Builder
    extends Object
    A builder for FlagSet instances.
    • Constructor Detail

      • Builder

        public Builder()
        Creates a builder.
    • Method Detail

      • addIf

        @CanIgnoreReturnValue
        public FlagSet.Builder addIf​(int flag,
                                     boolean condition)
        Adds a flag if the provided condition is true. Does nothing otherwise.
        Parameters:
        flag - A flag.
        condition - A condition.
        Returns:
        This builder.
        Throws:
        IllegalStateException - If build() has already been called.
      • addAll

        @CanIgnoreReturnValue
        public FlagSet.Builder addAll​(int... flags)
        Adds flags.
        Parameters:
        flags - The flags to add.
        Returns:
        This builder.
        Throws:
        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:
        flag - A flag.
        condition - A condition.
        Returns:
        This builder.
        Throws:
        IllegalStateException - If build() has already been called.
      • removeAll

        @CanIgnoreReturnValue
        public FlagSet.Builder removeAll​(int... flags)
        Removes flags.
        Parameters:
        flags - The flags to remove.
        Returns:
        This builder.
        Throws:
        IllegalStateException - If build() has already been called.