Package org.eclipse.handly.context

# Class Contexts

java.lang.Object
org.eclipse.handly.context.Contexts

public class Contexts extends Object
Provides static utility methods for creating and operating on `IContext`s.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final IContext`
  `EMPTY_CONTEXT`
  The empty context (immutable).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <T> IContext`
  `of(Class<T> clazz, T value)`
  Returns an immutable context containing only the given class-value binding.
  `static <T> IContext`
  `of(Property<T> property, T value)`
  Returns an immutable context containing only the given property-value binding.
  `static IContext`
  `with(List<IContext> contexts)`
  Returns a new context that combines the given contexts in the specified order.
  `static IContext`
  `with(IContext... contexts)`
  Returns a new context that combines the given contexts in the specified order.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### EMPTY_CONTEXT

    public static final IContext EMPTY_CONTEXT
    The empty context (immutable).

- ## Method Details

  - ### of

    public static <T> IContext of(Property<T> property, T value)
    Returns an immutable context containing only the given property-value binding.
    Type Parameters:
      `T` - type of value
    Parameters:
      `property` - not `null`
      `value` - may be `null`
    Returns:
      an immutable context containing only the given property-value binding (never `null`)

  - ### of

    public static <T> IContext of(Class<T> clazz, T value)
    Returns an immutable context containing only the given class-value binding.
    Type Parameters:
      `T` - type of value
    Parameters:
      `clazz` - not `null`
      `value` - may be `null`
    Returns:
      an immutable context containing only the given class-value binding (never `null`)

  - ### with

    public static IContext with(IContext... contexts)
    Returns a new context that combines the given contexts in the specified order.

    The returned context is immutable provided that each of the given contexts is immutable. If some of the given contexts are not immutable, the returned context is neither immutable nor thread-safe.

    Parameters:
      `contexts` - the contexts to combine
    Returns:
      the combined context (never `null`)

  - ### with

    public static IContext with(List<IContext> contexts)
    Returns a new context that combines the given contexts in the specified order.

    The returned context is immutable provided that each of the given contexts is immutable. If some of the given contexts are not immutable, the returned context is neither immutable nor thread-safe.

    Parameters:
      `contexts` - the contexts to combine
    Returns:
      the combined context (never `null`)