/** Returns a context that wraps a list of contexts. * * <p>A call to {@code unwrap(C)} will return the first object that is an * instance of {@code C}. * * <p>If any of the contexts is a {@link Context}, recursively looks in that * object. Thus this method can be used to chain contexts. */ public static Context chain(Context... contexts) { return chain(ImmutableList.copyOf(contexts)); }
/** Returns a context that wraps a list of contexts. * * <p>A call to {@code unwrap(C)} will return the first object that is an * instance of {@code C}. * * <p>If any of the contexts is a {@link Context}, recursively looks in that * object. Thus this method can be used to chain contexts. */ public static Context chain(Context... contexts) { return chain(ImmutableList.copyOf(contexts)); }
/** Returns a context that wraps an array of objects, ignoring any nulls. */ public static Context of(Object... os) { final List<Context> contexts = new ArrayList<>(); for (Object o : os) { if (o != null) { contexts.add(of(o)); } } return chain(contexts); }
/** Returns a context that wraps an array of objects, ignoring any nulls. */ public static Context of(Object... os) { final List<Context> contexts = new ArrayList<>(); for (Object o : os) { if (o != null) { contexts.add(of(o)); } } return chain(contexts); }