I'm not sure exactly yet what are ALL of my use cases :)
This is what I have right now:
property named LastProcessingTime , which has a specific representation of
Date (base on a format we have been using).
A class (the service) that needs to use this property as Date, and that
property is injecte
On 31 Jan 2012, at 16:41, egolan wrote:
> jordi,
> I tried that. the convertToTypes needs TypeLiteral.
>
> Tim & Stuart,
> This is great !!
> I think it is a good idea to inject all dates with that converter.
> However, just to understand. Is it possible to convert base on
> Annotation (or Named)
jordi,
I tried that. the convertToTypes needs TypeLiteral.
Tim & Stuart,
This is great !!
I think it is a good idea to inject all dates with that converter.
However, just to understand. Is it possible to convert base on
Annotation (or Named)
Thanks,
On Jan 31, 6:39 pm, jordi wrote:
> use a regu
use a regular guice Matcher [1], I guess this would do the trick:
import static com.google.inject.matcher.Matchers.annotatedWith;
// ...
protected void configure() {
convertToTypes(annotatedWith(Names.named("YOUR_KEY")), typeConverter);
}
jordi
[1]
http://google-guice.googlecode.com/svn/trunk
Thanks for the inputs.
The code example is what I needed.
However, using it will convert all Date classes that get injected.
Is there a way to create a converter only for parameters annotated with
Named ?
Eyal Golan
egola...@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.l
I recommend using Rocoto, too, but here's an example that shows how to do
it yourself, expressed as a JUnit test:
http://pastebin.com/mWx9xG4M
--tim
On Tue, Jan 31, 2012 at 10:10 AM, Stuart McCulloch wrote:
> On 31 Jan 2012, at 14:42, egolan wrote:
>
> > Hi,
> > I am using Names.bindProperties
On 31 Jan 2012, at 14:42, egolan wrote:
> Hi,
> I am using Names.bindProperties(binder(), properties); where my
> properties are taken from a pre-initialized configuration.
> One of the properties represent java.util.Date.
> We have a simple date format class that sets the value:
> SimpleDateForm
Hi,
I am using Names.bindProperties(binder(), properties); where my
properties are taken from a pre-initialized configuration.
One of the properties represent java.util.Date.
We have a simple date format class that sets the value:
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-
HH:m