Class MemoryStyleSource

java.lang.Object
org.jline.style.MemoryStyleSource
All Implemented Interfaces:
StyleSource

public class MemoryStyleSource extends Object implements StyleSource
In-memory implementation of StyleSource.

This class provides a thread-safe implementation of StyleSource that stores style definitions in memory using concurrent hash maps. It is suitable for use in applications that need to dynamically define and modify styles at runtime.

Example usage:

 MemoryStyleSource source = new MemoryStyleSource();
 source.set("messages", "error", "bold,fg:red");
 source.set("messages", "warning", "bold,fg:yellow");
 source.set("links", "url", "fg:blue,underline");

 // Use the source with a StyleResolver
 StyleResolver resolver = new StyleResolver(source, "messages");
 AttributedStyle errorStyle = resolver.resolve(".error");
 
Since:
3.4
See Also: