-
1. Re: The @In attribute requires non-null value fix?
lvdberg May 13, 2010 1:57 PM (in response to samuraicoder)Hi Dan,
depends a bit on what you want to do. If you need the component you could use the create is true attribute on the @In annotation or make the component autocreate with the @AutoCreate annotation. If you dont, set the required flag of @In to false.
However, the SIA book makes a clear statement about the required flag. If you have a lot of them in you code, you should try to split up your component in smaller ones.
Leo
-
2. Re: The @In attribute requires non-null value fix?
samuraicoder May 13, 2010 8:49 PM (in response to samuraicoder)Thanks Leo.
I guess I will go with create equals true attribute for now and see how we do.
-
3. Re: The @In attribute requires non-null value fix?
asookazian May 15, 2010 11:47 PM (in response to samuraicoder)It's better to use @AutoCreate on the component being injected rather than create=true (less typing)...
-
4. Re: The @In attribute requires non-null value fix?
samuraicoder May 17, 2010 6:12 PM (in response to samuraicoder)Can you explain why this is better?
Did you mean literally less characters to type? Or do you mean less type-casting or something that you could may help me by explaining.
Thanks a bunch!
-
5. Re: The @In attribute requires non-null value fix?
asookazian May 17, 2010 6:57 PM (in response to samuraicoder)@Name("foo") @AutoCreate public class Foo { //do something }
@Name("bar") public class Bar { @In Foo foo; }
So note above there is no @In(create=true), thus less typing every time you inject that component...
-
6. Re: The @In attribute requires non-null value fix?
kem May 19, 2010 10:46 PM (in response to samuraicoder)Thanks Arbi,
lets imagine Foo has not null properties populated from UI. Because of @AutoCreate, all these properties will be null once Foo is injected in Bar.
I have a similar problem as Dan. I have a Foo object with properties values from UI. I want to pass Foo to Bar in order to use these values inside Bar. @In Foo foo raise the @In attribute requires non-null exception.
@AutoCreate fix this exception issue. However the inject foo has all properties set to null.Any suggestion how to inject foo with all its properties preserved. Thanks.
Khalil