@Override public BaggageProvider<? extends BaggageContext> provider() { return new BDLContextProvider(BaggageHandlerRegistry.instance); }
/** * <p> * Update the {@link XTraceBaggage} set in {@code baggage}. This method will overwrite any existing * XTraceBaggage set in {@code baggage}. * </p> * * <p> * This method does <b>not</b> affect the {@link BaggageContext} being carried by the current thread. To set the * {@link XTraceBaggage} for the current thread, use {@link #set(XTraceBaggage)} * </p> * * @param baggage A baggage instance to set the {@link XTraceBaggage} in * @param xTraceBaggage the new XTraceBaggage to set in {@code baggage}. If {@code null}, it will remove any * mapping present. * @return a possibly new {@link BaggageContext} instance that contains all previous mappings plus the new mapping. */ public static BaggageContext setIn(BaggageContext baggage, XTraceBaggage xTraceBaggage) { return BDLContextProvider.set(baggage, Handler.registration(), xTraceBaggage); }
/** * <p> * Get the {@link ExampleBag} set in the active {@link BaggageContext} carried by the current thread. If no baggage is being * carried by the current thread, or if there is no ExampleBag in it, then this method returns {@code null}. * </p> * * <p> * To get ExampleBag from a specific Baggage instance, use {@link #getFrom(BaggageContext)}. * </p> * * @return the ExampleBag being carried in the {@link BaggageContext} of the current thread, or {@code null} * if none is being carried. The returned instance maybe be modified and modifications will be reflected in * the baggage. */ public static ExampleBag get() { Bag bag = BDLContextProvider.get(ActiveBaggage.peek(), Handler.registration()); if (bag instanceof ExampleBag) { return (ExampleBag) bag; } else { return null; } }
/** * <p> * Get the {@link XTraceBaggage} set in the active {@link BaggageContext} carried by the current thread. If no baggage is being * carried by the current thread, or if there is no XTraceBaggage in it, then this method returns {@code null}. * </p> * * <p> * To get XTraceBaggage from a specific Baggage instance, use {@link #getFrom(BaggageContext)}. * </p> * * @return the XTraceBaggage being carried in the {@link BaggageContext} of the current thread, or {@code null} * if none is being carried. The returned instance maybe be modified and modifications will be reflected in * the baggage. */ public static XTraceBaggage get() { Bag bag = BDLContextProvider.get(ActiveBaggage.peek(), Handler.registration()); if (bag instanceof XTraceBaggage) { return (XTraceBaggage) bag; } else { return null; } }
/** * <p> * Update the {@link ExampleBag} set in {@code baggage}. This method will overwrite any existing * ExampleBag set in {@code baggage}. * </p> * * <p> * This method does <b>not</b> affect the {@link BaggageContext} being carried by the current thread. To set the * {@link ExampleBag} for the current thread, use {@link #set(ExampleBag)} * </p> * * @param baggage A baggage instance to set the {@link ExampleBag} in * @param exampleBag the new ExampleBag to set in {@code baggage}. If {@code null}, it will remove any * mapping present. * @return a possibly new {@link BaggageContext} instance that contains all previous mappings plus the new mapping. */ public static BaggageContext setIn(BaggageContext baggage, ExampleBag exampleBag) { return BDLContextProvider.set(baggage, Handler.registration(), exampleBag); }
/** * <p> * Get the {@link FonsecaBag} set in the active {@link BaggageContext} carried by the current thread. If no baggage is being * carried by the current thread, or if there is no FonsecaBag in it, then this method returns {@code null}. * </p> * * <p> * To get FonsecaBag from a specific Baggage instance, use {@link #getFrom(BaggageContext)}. * </p> * * @return the FonsecaBag being carried in the {@link BaggageContext} of the current thread, or {@code null} * if none is being carried. The returned instance maybe be modified and modifications will be reflected in * the baggage. */ public static FonsecaBag get() { Bag bag = BDLContextProvider.get(ActiveBaggage.peek(), Handler.registration()); if (bag instanceof FonsecaBag) { return (FonsecaBag) bag; } else { return null; } }
/** * <p> * Update the {@link SimpleBag2} set in {@code baggage}. This method will overwrite any existing * SimpleBag2 set in {@code baggage}. * </p> * * <p> * This method does <b>not</b> affect the {@link BaggageContext} being carried by the current thread. To set the * {@link SimpleBag2} for the current thread, use {@link #set(SimpleBag2)} * </p> * * @param baggage A baggage instance to set the {@link SimpleBag2} in * @param simpleBag2 the new SimpleBag2 to set in {@code baggage}. If {@code null}, it will remove any * mapping present. * @return a possibly new {@link BaggageContext} instance that contains all previous mappings plus the new mapping. */ public static BaggageContext setIn(BaggageContext baggage, SimpleBag2 simpleBag2) { return BDLContextProvider.set(baggage, Handler.registration(), simpleBag2); }
/** * <p> * Get the {@link XTraceBaggage} set in {@code baggage}. If {@code baggage} has no XTraceBaggage set then * this method returns null. * </p> * * <p> * This method does <b>not</b> affect the Baggage being carried by the current thread. To get XTraceBaggage * from the current thread's Baggage, use {@link #get()}. * </p> * * @param baggage A baggage instance to get the {@link XTraceBaggage} from * @return the {@link XTraceBaggage} instance being carried in {@code baggage}, or {@code null} if none is being carried. * The returned instance can be modified, and modifications will be reflected in the baggage. */ public static XTraceBaggage getFrom(BaggageContext baggage) { Bag bag = BDLContextProvider.get(baggage, Handler.registration()); if (bag instanceof XTraceBaggage) { return (XTraceBaggage) bag; } else if (bag != null) { Handler.checkRegistration(); } return null; }
/** * <p> * Update the {@link FonsecaBag} set in {@code baggage}. This method will overwrite any existing * FonsecaBag set in {@code baggage}. * </p> * * <p> * This method does <b>not</b> affect the {@link BaggageContext} being carried by the current thread. To set the * {@link FonsecaBag} for the current thread, use {@link #set(FonsecaBag)} * </p> * * @param baggage A baggage instance to set the {@link FonsecaBag} in * @param fonsecaBag the new FonsecaBag to set in {@code baggage}. If {@code null}, it will remove any * mapping present. * @return a possibly new {@link BaggageContext} instance that contains all previous mappings plus the new mapping. */ public static BaggageContext setIn(BaggageContext baggage, FonsecaBag fonsecaBag) { return BDLContextProvider.set(baggage, Handler.registration(), fonsecaBag); }
/** * <p> * Get the {@link SimpleBag} set in the active {@link BaggageContext} carried by the current thread. If no baggage is being * carried by the current thread, or if there is no SimpleBag in it, then this method returns {@code null}. * </p> * * <p> * To get SimpleBag from a specific Baggage instance, use {@link #getFrom(BaggageContext)}. * </p> * * @return the SimpleBag being carried in the {@link BaggageContext} of the current thread, or {@code null} * if none is being carried. The returned instance maybe be modified and modifications will be reflected in * the baggage. */ public static SimpleBag get() { Bag bag = BDLContextProvider.get(ActiveBaggage.peek(), Handler.registration()); if (bag instanceof SimpleBag) { return (SimpleBag) bag; } else { return null; } }
/** * <p> * Update the {@link SimpleBag} set in {@code baggage}. This method will overwrite any existing * SimpleBag set in {@code baggage}. * </p> * * <p> * This method does <b>not</b> affect the {@link BaggageContext} being carried by the current thread. To set the * {@link SimpleBag} for the current thread, use {@link #set(SimpleBag)} * </p> * * @param baggage A baggage instance to set the {@link SimpleBag} in * @param simpleBag the new SimpleBag to set in {@code baggage}. If {@code null}, it will remove any * mapping present. * @return a possibly new {@link BaggageContext} instance that contains all previous mappings plus the new mapping. */ public static BaggageContext setIn(BaggageContext baggage, SimpleBag simpleBag) { return BDLContextProvider.set(baggage, Handler.registration(), simpleBag); }
/** * <p> * Get the {@link SimpleBag2} set in the active {@link BaggageContext} carried by the current thread. If no baggage is being * carried by the current thread, or if there is no SimpleBag2 in it, then this method returns {@code null}. * </p> * * <p> * To get SimpleBag2 from a specific Baggage instance, use {@link #getFrom(BaggageContext)}. * </p> * * @return the SimpleBag2 being carried in the {@link BaggageContext} of the current thread, or {@code null} * if none is being carried. The returned instance maybe be modified and modifications will be reflected in * the baggage. */ public static SimpleBag2 get() { Bag bag = BDLContextProvider.get(ActiveBaggage.peek(), Handler.registration()); if (bag instanceof SimpleBag2) { return (SimpleBag2) bag; } else { return null; } }
/** * <p> * Update the {@link SimpleBag} set in the current thread's baggage. This method will overwrite any existing * SimpleBag set in the current thread's baggage. * </p> * * <p> * To set the {@link SimpleBag} in a specific {@link BaggageContext} instance, use * {@link #setIn(BaggageContext, SimpleBag)} * </p> * * @param simpleBag the new {@link SimpleBag} to set in the current thread's {@link BaggageContext}. If {@code null} * then any existing mappings will be removed. */ public static void set(SimpleBag simpleBag) { ActiveBaggage.update(BDLContextProvider.set(ActiveBaggage.peek(), Handler.registration(), simpleBag)); }
/** * <p> * Get the {@link ExampleBag} set in {@code baggage}. If {@code baggage} has no ExampleBag set then * this method returns null. * </p> * * <p> * This method does <b>not</b> affect the Baggage being carried by the current thread. To get ExampleBag * from the current thread's Baggage, use {@link #get()}. * </p> * * @param baggage A baggage instance to get the {@link ExampleBag} from * @return the {@link ExampleBag} instance being carried in {@code baggage}, or {@code null} if none is being carried. * The returned instance can be modified, and modifications will be reflected in the baggage. */ public static ExampleBag getFrom(BaggageContext baggage) { Bag bag = BDLContextProvider.get(baggage, Handler.registration()); if (bag instanceof ExampleBag) { return (ExampleBag) bag; } else if (bag != null) { Handler.checkRegistration(); } return null; }
/** * <p> * Update the {@link ExampleBag} set in the current thread's baggage. This method will overwrite any existing * ExampleBag set in the current thread's baggage. * </p> * * <p> * To set the {@link ExampleBag} in a specific {@link BaggageContext} instance, use * {@link #setIn(BaggageContext, ExampleBag)} * </p> * * @param exampleBag the new {@link ExampleBag} to set in the current thread's {@link BaggageContext}. If {@code null} * then any existing mappings will be removed. */ public static void set(ExampleBag exampleBag) { ActiveBaggage.update(BDLContextProvider.set(ActiveBaggage.peek(), Handler.registration(), exampleBag)); }
/** * <p> * Get the {@link SimpleBag} set in {@code baggage}. If {@code baggage} has no SimpleBag set then * this method returns null. * </p> * * <p> * This method does <b>not</b> affect the Baggage being carried by the current thread. To get SimpleBag * from the current thread's Baggage, use {@link #get()}. * </p> * * @param baggage A baggage instance to get the {@link SimpleBag} from * @return the {@link SimpleBag} instance being carried in {@code baggage}, or {@code null} if none is being carried. * The returned instance can be modified, and modifications will be reflected in the baggage. */ public static SimpleBag getFrom(BaggageContext baggage) { Bag bag = BDLContextProvider.get(baggage, Handler.registration()); if (bag instanceof SimpleBag) { return (SimpleBag) bag; } else if (bag != null) { Handler.checkRegistration(); } return null; }
/** * <p> * Update the {@link SimpleBag2} set in the current thread's baggage. This method will overwrite any existing * SimpleBag2 set in the current thread's baggage. * </p> * * <p> * To set the {@link SimpleBag2} in a specific {@link BaggageContext} instance, use * {@link #setIn(BaggageContext, SimpleBag2)} * </p> * * @param simpleBag2 the new {@link SimpleBag2} to set in the current thread's {@link BaggageContext}. If {@code null} * then any existing mappings will be removed. */ public static void set(SimpleBag2 simpleBag2) { ActiveBaggage.update(BDLContextProvider.set(ActiveBaggage.peek(), Handler.registration(), simpleBag2)); }
/** * <p> * Get the {@link SimpleBag2} set in {@code baggage}. If {@code baggage} has no SimpleBag2 set then * this method returns null. * </p> * * <p> * This method does <b>not</b> affect the Baggage being carried by the current thread. To get SimpleBag2 * from the current thread's Baggage, use {@link #get()}. * </p> * * @param baggage A baggage instance to get the {@link SimpleBag2} from * @return the {@link SimpleBag2} instance being carried in {@code baggage}, or {@code null} if none is being carried. * The returned instance can be modified, and modifications will be reflected in the baggage. */ public static SimpleBag2 getFrom(BaggageContext baggage) { Bag bag = BDLContextProvider.get(baggage, Handler.registration()); if (bag instanceof SimpleBag2) { return (SimpleBag2) bag; } else if (bag != null) { Handler.checkRegistration(); } return null; }
/** * <p> * Update the {@link FonsecaBag} set in the current thread's baggage. This method will overwrite any existing * FonsecaBag set in the current thread's baggage. * </p> * * <p> * To set the {@link FonsecaBag} in a specific {@link BaggageContext} instance, use * {@link #setIn(BaggageContext, FonsecaBag)} * </p> * * @param fonsecaBag the new {@link FonsecaBag} to set in the current thread's {@link BaggageContext}. If {@code null} * then any existing mappings will be removed. */ public static void set(FonsecaBag fonsecaBag) { ActiveBaggage.update(BDLContextProvider.set(ActiveBaggage.peek(), Handler.registration(), fonsecaBag)); }
/** * <p> * Get the {@link FonsecaBag} set in {@code baggage}. If {@code baggage} has no FonsecaBag set then * this method returns null. * </p> * * <p> * This method does <b>not</b> affect the Baggage being carried by the current thread. To get FonsecaBag * from the current thread's Baggage, use {@link #get()}. * </p> * * @param baggage A baggage instance to get the {@link FonsecaBag} from * @return the {@link FonsecaBag} instance being carried in {@code baggage}, or {@code null} if none is being carried. * The returned instance can be modified, and modifications will be reflected in the baggage. */ public static FonsecaBag getFrom(BaggageContext baggage) { Bag bag = BDLContextProvider.get(baggage, Handler.registration()); if (bag instanceof FonsecaBag) { return (FonsecaBag) bag; } else if (bag != null) { Handler.checkRegistration(); } return null; }