/** * Gets the localized message indexed by the provided enumeration key, * applying an array of objects as parameters. This method is a wrapper to * the conveyor's method of the same name. * @param <E> Enumeration type that represents the conveyor messages. * @param key Key set in the provided enumeration type. * @param parameters Array of objects to be used as parameters. * @return A string containing a localized message indexed by the provided * enumeration key and applied the array of objects as parameters. */ public <E extends Enum<?>> String getMessage(E key, Object... parameters) { return conveyor.getMessage(key, parameters); }
/** * Gets the localized message indexed by the provided enumeration key. This * method is a wrapper to the conveyor's method of the same name. * @param <E> Enumeration type that represents the conveyor messages. * @param key Key set in the provided enumeration type. * @return A string containing a localized message indexed by the provided * enumeration key. */ public <E extends Enum<?>> String getMessage(E key) { return conveyor.getMessage(key); }
/** * Returns the localized error message corresponding to the given message code. * * @param <E> * Enum for the message code * @param messageCode * Error code to localize from Enum * @param args * Arguments for parametric replacement * @return Localized error message */ public <E extends Enum<?>> String getMessage(E messageCode, Object... args) { String message = mc.getMessage(messageCode, args); return message; }
/** * Log a localized message at the DEBUG level. * * @param key * the key used for localization * @param args * optional arguments */ public void debug(Enum<?> key, Object... args) { if (!logger.isDebugEnabled()) { return; } String translatedMsg = imc.getMessage(key, args); MessageParameterObj mpo = new MessageParameterObj(key, args); if (instanceofLAL) { ((LocationAwareLogger) logger).log(LOCALIZED, FQCN, LocationAwareLogger.DEBUG_INT, translatedMsg, args, null); } else { logger.debug(LOCALIZED, translatedMsg, mpo); } }
/** * Log a localized message at the WARN level. * * @param key * the key used for localization * @param args * optional arguments */ public void warn(Enum<?> key, Object... args) { if (!logger.isWarnEnabled()) { return; } String translatedMsg = imc.getMessage(key, args); MessageParameterObj mpo = new MessageParameterObj(key, args); if (instanceofLAL) { ((LocationAwareLogger) logger).log(LOCALIZED, FQCN, LocationAwareLogger.WARN_INT, translatedMsg, args, null); } else { logger.warn(LOCALIZED, translatedMsg, mpo); } }
/** * Log a localized message at the ERROR level. * * @param key * the key used for localization * @param args * optional arguments */ public void error(Enum<?> key, Object... args) { if (!logger.isErrorEnabled()) { return; } String translatedMsg = imc.getMessage(key, args); MessageParameterObj mpo = new MessageParameterObj(key, args); if (instanceofLAL) { ((LocationAwareLogger) logger).log(LOCALIZED, FQCN, LocationAwareLogger.ERROR_INT, translatedMsg, args, null); } else { logger.error(LOCALIZED, translatedMsg, mpo); } }
/** * Log a localized message at the TRACE level. * * @param key * the key used for localization * @param args * optional arguments */ public void trace(Enum<?> key, Object... args) { if (!logger.isTraceEnabled()) { return; } String translatedMsg = imc.getMessage(key, args); MessageParameterObj mpo = new MessageParameterObj(key, args); if (instanceofLAL) { ((LocationAwareLogger) logger).log(LOCALIZED, FQCN, LocationAwareLogger.TRACE_INT, translatedMsg, args, null); } else { logger.trace(LOCALIZED, translatedMsg, mpo); } }
/** * Log a localized message at the INFO level. * * @param key * the key used for localization * @param args * optional arguments */ public void info(Enum<?> key, Object... args) { if (!logger.isInfoEnabled()) { return; } String translatedMsg = imc.getMessage(key, args); MessageParameterObj mpo = new MessageParameterObj(key, args); if (instanceofLAL) { ((LocationAwareLogger) logger).log(LOCALIZED, FQCN, LocationAwareLogger.INFO_INT, translatedMsg, args, null); } else { logger.info(LOCALIZED, translatedMsg, mpo); } }
throw new NullPointerException(messages.getMessage(ExceptionFactoryErrors.NO_MATCHING_CONSTRUCTOR)); throw new IllegalArgumentException(messages.getMessage(ExceptionFactoryErrors.TYPE_IS_ABSTRACT)); } catch (final IllegalAccessException exception) { throw new IllegalArgumentException(messages.getMessage(ExceptionFactoryErrors.NO_ACCESSIBLE_CONSTRUCTOR)); } catch (final NoSuchMethodException exception) { if (hasMessage) { throw new IllegalArgumentException( messages.getMessage(ExceptionFactoryErrors.NO_STRING_CONSTRUCTOR, clause.toString())); messages.getMessage(ExceptionFactoryErrors.NO_DEFAULT_CONSTRUCTOR, clause.toString())); } catch (final SecurityException exception) { throw exception; throw exception; } catch (final InvocationTargetException exception) { throw new IllegalArgumentException(messages.getMessage(ExceptionFactoryErrors.CONSTRUCTOR_EXCEPTION, exception.getLocalizedMessage()));