Class Contexts


  • public class Contexts
    extends java.lang.Object
    Utilities for Context.
    • Constructor Detail

      • Contexts

        private Contexts()
    • Method Detail

      • empty

        public static Context empty()
        Returns a context that returns null for all inquiries.
      • of

        public static Context of​(java.lang.Object o)
        Returns a context that wraps an object.

        A call to unwrap(C) will return target if it is an instance of C.

      • of

        public static Context of​(java.lang.Object... os)
        Returns a context that wraps an array of objects, ignoring any nulls.
      • chain

        public static Context chain​(Context... contexts)
        Returns a context that wraps a list of contexts.

        A call to unwrap(C) will return the first object that is an instance of C.

        If any of the contexts is a Context, recursively looks in that object. Thus this method can be used to chain contexts.

      • chain

        private static Context chain​(java.lang.Iterable<? extends Context> contexts)
      • build

        private static void build​(java.util.List<Context> list,
                                  Context context)
        Recursively populates a list of contexts.