Package org.jline.style
Interface StyleBundle
public interface StyleBundle
Marker interface for proxy-based style bundles.
A StyleBundle is an interface that defines methods for creating styled text.
Each method in the interface should return an AttributedString
and take a single parameter that will be styled according to the method's
StyleBundle.DefaultStyle annotation or a style definition from a StyleSource.
StyleBundle interfaces are not implemented directly. Instead, they are used with
the Styler.bundle(Class) or Styler.bundle(String, Class) methods
to create dynamic proxies that implement the interface.
Example:
@StyleBundle.StyleGroup("mygroup")
interface MyStyles extends StyleBundle {
@StyleBundle.DefaultStyle("bold,fg:red")
AttributedString error(String message);
@StyleBundle.DefaultStyle("bold,fg:yellow")
AttributedString warning(String message);
}
MyStyles styles = Styler.bundle(MyStyles.class);
AttributedString errorText = styles.error("Error message");
- Since:
- 3.4
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic @interfaceAnnotation that provides a default style specification for a method in a StyleBundle interface.static @interfaceAnnotation that specifies the style group name for a StyleBundle interface.static @interfaceAnnotation that allows overriding the style name for a method in a StyleBundle interface.