Also, note that this returned wrapper will always implement the MessageInfo interface, which provides a way to capture all of the messages and IDs used in the interface. This is used to generate resource bundles. In order for this to work, it is required that the interface declare a field
public static final [class name] self = ExceptionWrapper.makeWrapper( ... ) ;
This is necessary because the extension mechanism allows the construction of message IDs that cannot be predicted based on the annotations alone.
The behavior of the implementation of each method on the interface is determined in part by its return type as follows:
<loggerName>.<methodName>. The message is prepended with the
idPrefix and the id from the @Log annotation (if @Log is present, otherwise nothing
is prepended to the message). If this annotation is not present, a default message
is created from the method name and the arguments.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | WrapperGenerator.
Extension API available to override the default behavior of the WrapperGenerator. |
| public abstract static class | WrapperGenerator.
Convenience base class for implementations of Extension that don't need to override every method. |
| public static interface | WrapperGenerator.
Hidden interface implemented by the result of the makeWrapper call. |
| pack-priv static enum | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final AnnotationAnalyzer | |
| pack-priv static final String | |
| pack-priv static final WrapperGenerator. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static WrapperGenerator. | |
| pack-priv static int | |
| pack-priv static String | |
| pack-priv static Map | |
| pack-priv static String | |
| pack-priv static String | |
| pack-priv static String | |
| public static String | Returns: The ID (as a string), or null if no @Log annotation is present.The method for which the ID is requested. method)Expose the standard log ID for the method. |
| pack-priv static Object[] | |
| pack-priv static Object | handleFullLogging(Log log, Method method, WrapperGenerator.
|
| pack-priv static String | handleMessageOnly(Method method, WrapperGenerator.
|
| pack-priv static boolean | |
| pack-priv static LogRecord | |
| pack-priv static Throwable | |
| public static < The annotated interface type. T> T | Returns: An instance of the interface.The class of the annotated interface. cls)Given an interface annotated with @ExceptionWrapper, return a proxy implementing the interface. |
| public static < The annotated interface type. T> T | Returns: An instance of the interface.The class of the annotated interface. cls, final WrapperGenerator.The extension instance used to override the default
behavior. extensionGiven an interface annotated with @ExceptionWrapper, return a proxy implementing the interface. |
| pack-priv static boolean | |
| pack-priv static void |
| aa | back to summary |
|---|---|
| pack-priv static final AnnotationAnalyzer aa | |
| cihiName | back to summary |
|---|---|
| pack-priv static final String cihiName | |
| stdExtension | back to summary |
|---|---|
| pack-priv static final WrapperGenerator. | |
| WrapperGenerator | back to summary |
|---|---|
| private WrapperGenerator() | |
| classifyReturnType | back to summary |
|---|---|
| pack-priv static WrapperGenerator. | |
| findAnnotatedParameter | back to summary |
|---|---|
| pack-priv static int findAnnotatedParameter(Annotation[][] pannos, Class<? extends Annotation> cls) | |
| getMessage | back to summary |
|---|---|
| pack-priv static String getMessage(Method method, String prefix, WrapperGenerator. | |
| getMessageMap | back to summary |
|---|---|
| pack-priv static Map | |
| getMessageOrKey | back to summary |
|---|---|
| pack-priv static String getMessageOrKey(Logger logger, Method method, WrapperGenerator. | |
| getMsgKey | back to summary |
|---|---|
| pack-priv static String getMsgKey(String logger, Method method) | |
| getStandardLoggerName | back to summary |
|---|---|
| pack-priv static String getStandardLoggerName(Class<?> cls) | |
| getStandardLogId | back to summary |
|---|---|
| public static String getStandardLogId(Method method) Expose the standard log ID for the method. This is simply the annotated value in the @Log annotation: it is not processed in any way. | |
| getWithSkip | back to summary |
|---|---|
| pack-priv static Object[] getWithSkip(Object[] args, int skip) | |
| handleFullLogging | back to summary |
|---|---|
| pack-priv static Object handleFullLogging(Log log, Method method, WrapperGenerator. | |
| handleMessageOnly | back to summary |
|---|---|
| pack-priv static String handleMessageOnly(Method method, WrapperGenerator. | |
| isMajorLevel | back to summary |
|---|---|
| pack-priv static boolean isMajorLevel(Level level) | |
| makeLogRecord | back to summary |
|---|---|
| pack-priv static LogRecord makeLogRecord(Level level, String key, Object[] args, Logger logger) | |
| makeStandardException | back to summary |
|---|---|
| pack-priv static Throwable makeStandardException(final String msg, final Method method) | |
| makeWrapper | back to summary |
|---|---|
| public static <T> T makeWrapper(final Class<T> cls) Given an interface annotated with @ExceptionWrapper, return a proxy implementing the interface.
| |
| makeWrapper | back to summary |
|---|---|
| public static <T> T makeWrapper(final Class<T> cls, final WrapperGenerator. Given an interface annotated with @ExceptionWrapper, return a proxy implementing the interface.
| |
| needStackTrace | back to summary |
|---|---|
| pack-priv static boolean needStackTrace(Level level, Method method) | |
| trimStackTrace | back to summary |
|---|---|
| pack-priv static void trimStackTrace(Throwable exc, LogRecord lrec) | |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: A possibly updated logger nameThe standard logger name cls)Modify the default logger name if needed. |
| public String | |
| public Throwable | makeException(String
The message to use in the exception. msg, Method The method creating the exception. method)Construct an exception from the message and the exception type. |
| getLoggerName | back to summary |
|---|---|
| public String getLoggerName(Class<?> cls) Modify the default logger name if needed. | |
| getLogId | back to summary |
|---|---|
| public String getLogId(Method method) Get a message id for this log. | |
| makeException | back to summary |
|---|---|
| public Throwable makeException(String msg, Method method) Construct an exception from the message and the exception type. The method provides access to any additional annotations that may be needed. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | getLoggerName(Class<?> cls)
Implements org. Modify the default logger name if needed. |
| public String | getLogId(Method method)
Implements org. Get a message id for this log. |
| public Throwable | makeException(String msg, Method method)
Implements org. Construct an exception from the message and the exception type. |
| ExtensionBase | back to summary |
|---|---|
| public ExtensionBase() | |
| getLoggerName | back to summary |
|---|---|
| public String getLoggerName(Class<?> cls) Implements org. Doc from org. Modify the default logger name if needed.
| |
| getLogId | back to summary |
|---|---|
| public String getLogId(Method method) Implements org. Doc from org. Get a message id for this log.
| |
| makeException | back to summary |
|---|---|
| public Throwable makeException(String msg, Method method) Implements org. Doc from org. Construct an exception from the message and the exception type. The method provides access to any additional annotations that may be needed.
| |
| Modifier and Type | Method and Description |
|---|---|
| public Map | Returns: map from message ID to message.Return a map from message ID to message for all exceptions defined in a @ExceptionWrapper interface. |
| getMessageInfo | back to summary |
|---|---|
| public Map Return a map from message ID to message for all exceptions defined in a @ExceptionWrapper interface. The key in the result is the message ID, and the value is the message string (defined in @Message). | |
| Modifier and Type | Field and Description |
|---|---|
| public static final WrapperGenerator. | |
| public static final WrapperGenerator. | |
| public static final WrapperGenerator. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static WrapperGenerator. | |
| public static WrapperGenerator. |
| EXCEPTION | back to summary |
|---|---|
| public static final WrapperGenerator. | |
| NULL | back to summary |
|---|---|
| public static final WrapperGenerator. | |
| STRING | back to summary |
|---|---|
| public static final WrapperGenerator. | |
| ReturnType | back to summary |
|---|---|
| private ReturnType() | |
| valueOf | back to summary |
|---|---|
| public static WrapperGenerator. | |
| values | back to summary |
|---|---|
| public static WrapperGenerator. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String | format(LogRecord record)
Implements abstract java. Format the given log record and return the formatted string. |
| ShortFormatter | back to summary |
|---|---|
| pack-priv ShortFormatter() | |
| format | back to summary |
|---|---|
| public String format(LogRecord record) Implements abstract java. Doc from java. Format the given log record and return the formatted string.
The resulting formatted String will normally include a
localized and formatted version of the LogRecord's message field.
It is recommended to use the
| |