Class ContextSet.Builder

java.lang.Object
dev.polv.taleapi.permission.ContextSet.Builder
Enclosing class:
ContextSet

public static final class ContextSet.Builder extends Object
Builder for creating ContextSet instances.
  • Method Details

    • add

      public <T> ContextSet.Builder add(ContextKey<T> key, T value)
      Adds a context key-value pair.
      Type Parameters:
      T - the value type
      Parameters:
      key - the context key
      value - the context value
      Returns:
      this builder for chaining
    • add

      public ContextSet.Builder add(String key, String value)
      Adds a raw string key-value pair.

      Prefer using typed ContextKey when possible.

      Parameters:
      key - the context key name
      value - the context value
      Returns:
      this builder for chaining
    • addAll

      public ContextSet.Builder addAll(ContextSet other)
      Adds all contexts from another ContextSet.
      Parameters:
      other - the context set to copy from
      Returns:
      this builder for chaining
    • build

      public ContextSet build()
      Builds the immutable ContextSet.
      Returns:
      a new ContextSet