Package org.jline.style
Interface StyleBundle
-
public interface StyleBundleMarker 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
AttributedStringand take a single parameter that will be styled according to the method'sStyleBundle.DefaultStyleannotation or a style definition from aStyleSource.StyleBundle interfaces are not implemented directly. Instead, they are used with the
Styler.bundle(Class)orStyler.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:
Styler.bundle(Class),Styler.bundle(String, Class)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceStyleBundle.DefaultStyleAnnotation that provides a default style specification for a method in a StyleBundle interface.static interfaceStyleBundle.StyleGroupAnnotation that specifies the style group name for a StyleBundle interface.static interfaceStyleBundle.StyleNameAnnotation that allows overriding the style name for a method in a StyleBundle interface.
-