Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Ben Weidig <[email protected]>
Newsgroups gmane.comp.jakarta.tapestry.devel
Message-ID <CAMa1C31h7Rba2hTzs9ej01FYB_uV8JTasYtk9QuRuSddthQ2mA@mail.gmail.com>
Hello!

As discussed in a previous thread, I've created an issue for adding
"boolean optional() default false" to @InjectComponent to complement
@DisableStrictChecks.

https://issues.apache.org/jira/projects/TAP5/issues/TAP5-2727

The ticket contains a patch with an attempt to implement the required
behavior, plus some tests.
If optional() == true, the InjectComponentWorker just ignores the
UnknownValueException and the embedded component will be null.

That was the easiest way to implement it.
Another option would be creating a proxy in case of an optional and missing
component, which reacts with an appropriate Exception if used.
Or do you think that's overkill?
Like @DisableStrictChecks, it's more of an advanced use case.

Cheers,
Ben
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.