@Test public void minimal() { MessageConveyor mc = new MessageConveyor(Locale.ENGLISH); assertEquals("A", mc.getMessage(Minimal.A)); }
public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = cache.get(declaringClassName); if (rb == null || rb.hasChanged()) { rb = lookupResourceBundleByEnumClassAndLocale(declaringClass); cache.put(declaringClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "No key found for " + keyAsStr; } else { if (args == null || args.length == 0) { return value; } else { return MessageFormat.format(value, args); } } }
MessageConveyor implements IMessageConveyor { public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = cache.get(declaringClassName); if (rb == null || rb.hasChanged()) { rb = lookupResourceBundleByEnumClassAndLocale(declaringClass); cache.put(declaringClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "No key found for " + keyAsStr; } else { if (args == null || args.length == 0) { return value; } else { return MessageFormat.format(value, args); } } } }
MessageConveyor implements IMessageConveyor { public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = cache.get(declaringClassName); if (rb == null || rb.hasChanged()) { rb = lookupResourceBundleByEnumClassAndLocale(declaringClass); cache.put(declaringClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "No key found for " + keyAsStr; } else { if (args == null || args.length == 0) { return value; } else { return MessageFormat.format(value, args); } } } MessageConveyor(Locale locale); }
MessageConveyor implements IMessageConveyor { public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = cache.get(declaringClassName); if (rb == null || rb.hasChanged()) { rb = lookupResourceBundleByEnumClassAndLocale(declaringClass); cache.put(declaringClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "No key found for " + keyAsStr; } else { if (args == null || args.length == 0) { return value; } else { return MessageFormat.format(value, args); } } } MessageConveyor(Locale locale); String getMessage(E key, Object... args); String getMessage(MessageParameterObj mpo); }
MessageConveyor implements IMessageConveyor { public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = cache.get(declaringClassName); if (rb == null || rb.hasChanged()) { rb = lookupResourceBundleByEnumClassAndLocale(declaringClass); cache.put(declaringClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "No key found for " + keyAsStr; } else { if (args == null || args.length == 0) { return value; } else { return MessageFormat.format(value, args); } } } MessageConveyor(Locale locale); String getMessage(E key, Object... args); String getMessage(MessageParameterObj mpo);  }