Package org.jline.style
Class StyleBundleInvocationHandler
- java.lang.Object
-
- org.jline.style.StyleBundleInvocationHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
class StyleBundleInvocationHandler extends java.lang.Object implements java.lang.reflect.InvocationHandlerStyleBundleproxy invocation-handler to convert method calls into string styling.- Since:
- 3.4
- See Also:
StyleBundle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classStyleBundleInvocationHandler.InvalidStyleBundleMethodExceptionThrown when processingStyleBundlemethod is found to be invalid.(package private) static classStyleBundleInvocationHandler.InvalidStyleGroupExceptionThrown when looking upStyleBundle.StyleGroupon a type found to be missing or invalid.(package private) static classStyleBundleInvocationHandler.StyleBundleMethodMissingDefaultStyleExceptionThrown whenStyleBundlemethod has missingStyleBundle.DefaultStyle.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Loggerlogprivate StyleResolverresolverprivate java.lang.Class<? extends StyleBundle>type
-
Constructor Summary
Constructors Constructor Description StyleBundleInvocationHandler(java.lang.Class<? extends StyleBundle> type, StyleResolver resolver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static <T extends StyleBundle>
Tcreate(StyleResolver resolver, java.lang.Class<T> type)Internal factory-method.(package private) static <T extends StyleBundle>
Tcreate(StyleSource source, java.lang.Class<T> type)Internal factory-method.private static java.lang.StringemptyToNull(java.lang.String value)private static java.lang.StringgetDefaultStyle(java.lang.reflect.Method method)Returns the default-style for given method, ornullif unable to determine.private static java.lang.StringgetStyleGroup(java.lang.Class<?> type)Returns the style group-name for given type, ornullif unable to determine.private static java.lang.StringgetStyleName(java.lang.reflect.Method method)Returns the style-name for given method, ornullif unable to determine.java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)java.lang.StringtoString()Slightly better logging for proxies.private static voidvalidate(java.lang.reflect.Method method)ThrowsStyleBundleInvocationHandler.InvalidStyleBundleMethodExceptionif given method is not suitable.
-
-
-
Field Detail
-
log
private static final java.util.logging.Logger log
-
type
private final java.lang.Class<? extends StyleBundle> type
-
resolver
private final StyleResolver resolver
-
-
Constructor Detail
-
StyleBundleInvocationHandler
public StyleBundleInvocationHandler(java.lang.Class<? extends StyleBundle> type, StyleResolver resolver)
-
-
Method Detail
-
validate
private static void validate(java.lang.reflect.Method method)
ThrowsStyleBundleInvocationHandler.InvalidStyleBundleMethodExceptionif given method is not suitable.
-
emptyToNull
@Nullable private static java.lang.String emptyToNull(@Nullable java.lang.String value)
-
getStyleGroup
@Nullable private static java.lang.String getStyleGroup(java.lang.Class<?> type)
Returns the style group-name for given type, ornullif unable to determine.
-
getStyleName
private static java.lang.String getStyleName(java.lang.reflect.Method method)
Returns the style-name for given method, ornullif unable to determine.
-
getDefaultStyle
@Nullable private static java.lang.String getDefaultStyle(java.lang.reflect.Method method)
Returns the default-style for given method, ornullif unable to determine.
-
create
static <T extends StyleBundle> T create(StyleResolver resolver, java.lang.Class<T> type)
Internal factory-method.- See Also:
Styler.bundle(Class)
-
create
static <T extends StyleBundle> T create(StyleSource source, java.lang.Class<T> type)
Internal factory-method.- See Also:
Styler.bundle(String, Class)
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
toString
public java.lang.String toString()
Slightly better logging for proxies.- Overrides:
toStringin classjava.lang.Object
-
-