Class ScopedValuesPreviewNotes

java.lang.Object
net.jrodolfo.java_evolution.java21.scoped_values.ScopedValuesPreviewNotes

public class ScopedValuesPreviewNotes extends Object
Explains scoped values as a Java 21 first preview feature.

Contextual data such as request IDs, tenant IDs, trace IDs, or security context is often needed several calls below the method that first received it. Passing that value through every method can make signatures noisy, while ThreadLocal can introduce mutable state, cleanup burden, and stale context risks.

Java 21 previewed scoped values as a safer model for immutable contextual data with a bounded lifetime. This package documents the first-preview step and points to the Java 25 module for final runnable code.

  • Constructor Details

    • ScopedValuesPreviewNotes

      public ScopedValuesPreviewNotes()
  • Method Details

    • problemSolved

      public String problemSolved()
      Explains the contextual-data problem.
      Returns:
      a short explanation
    • threadLocalProblem

      public String threadLocalProblem()
      Explains the common older approach and its risks.
      Returns:
      a short explanation
    • previewIdea

      public String previewIdea()
      Explains the preview idea.
      Returns:
      a short explanation
    • firstPreviewStatus

      public String firstPreviewStatus()
      Describes the Java 21 maturity level.
      Returns:
      a short status note
    • nextStep

      public String nextStep()
      Points learners to the final Java 25 module.
      Returns:
      a short next-step note