deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject MessageBuilder take3
Date Thu, 28 Jun 2012 06:26:29 GMT
... and a take 4 will follow I'm sure :)

Hi!

The MessageBuilder is now working a bit better, but I'm still not satisfied.

What I changed so far: 

How it works:

There are 2 big areas in the game

1.) the MessageContext. This contains the core messaging functionality, a fluent API and a
configuration section.



2.) the typesafe @MessageBundle + MessageBundleInvocationHandler. There have been lot's of
code inside the invocation handler which logically should rather be handled in the MessageContext.
I now moved the whole ResourceBundle handling to the MessageContext for example. Prior to
that it had not been possible to create a messagebundle text with the fluent api. I'm still
not 100% happy with some parts but the functionality works now at least.



It's now also a bit easier to change the default behaviour of the MessageContext.
The configuration consists off 3 parts

a.) the LocaleResolver (resolves en_US, de_AT, ...). We do not inject a final Locale but only
the Resolver, because in e.g. JSF this information can be taken from the ViewRoot, the logged
in user, etc...

b.) the MessageInterpolator. The default one now uses the String.format which allows lots
of tweaks. If someone used the java.text.MessageFormat in his project in the past, then he
can simply change this now.

c.) the MessageResolver. This is the location where messages will be taken from the ResourceBundle.
I needed to add an 'initialize' method which is slightly 'out of tune' from my gut feeling.
Maybe we should give it a way to resolve the other configurations from the MessageContext?
Please review!

I'll write another mail about the @DefaultConfiguration...

LieGrue,
strub


Mime
View raw message