Package org.eclipse.handly.context
Class Contexts
- java.lang.Object
-
- org.eclipse.handly.context.Contexts
-
public class Contexts extends java.lang.ObjectProvides static utility methods for creating and operating onIContexts.
-
-
Field Summary
Fields Modifier and Type Field Description static IContextEMPTY_CONTEXTThe empty context (immutable).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> IContextof(java.lang.Class<T> clazz, T value)Returns an immutable context containing only the given class-value binding.static <T> IContextof(Property<T> property, T value)Returns an immutable context containing only the given property-value binding.static IContextwith(java.util.List<IContext> contexts)Returns a new context that combines the given contexts in the specified order.static IContextwith(IContext... contexts)Returns a new context that combines the given contexts in the specified order.
-
-
-
Field Detail
-
EMPTY_CONTEXT
public static final IContext EMPTY_CONTEXT
The empty context (immutable).
-
-
Method Detail
-
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- notnullvalue- may benull- Returns:
- an immutable context containing only the given property-value
binding (never
null)
-
of
public static <T> IContext of(java.lang.Class<T> clazz, T value)
Returns an immutable context containing only the given class-value binding.- Type Parameters:
T- type of value- Parameters:
clazz- notnullvalue- may benull- 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(java.util.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)
-
-