How well you know me ;)
yes, if you could start documenting this as well, this would be a big plus...
A first starting point:
look into DigesterFacesConfigUnmarshallerImpl, section:
digester.addObjectCreate("faces-config/converter", Converter.class);
digester.addSetNext("faces-config/converter", "addConverter");
digester.addCallMethod("faces-config/converter/converter-id",
"setConverterId", 0);
digester.addCallMethod("faces-config/converter/converter-for-class",
"setForClass", 0);
digester.addCallMethod("faces-config/converter/converter-class",
"setConverterClass", 0);
digester.addObjectCreate("faces-config/converter/attribute",Attribute.class);
digester.addSetNext("faces-config/converter/attribute","addAttribute");
digester.addCallMethod("faces-config/converter/attribute/description",
"addDescription", 0);
digester.addCallMethod("faces-config/converter/attribute/display-name",
"addDisplayName", 0);
digester.addCallMethod("faces-config/converter/attribute/icon",
"addIcon", 0);
digester.addCallMethod("faces-config/converter/attribute/attribute-name",
"setAttributeName", 0);
digester.addCallMethod("faces-config/converter/attribute/attribute-class",
"setAttributeClass", 0);
digester.addCallMethod("faces-config/converter/attribute/default-value",
"setDefaultValue", 0);
digester.addCallMethod("faces-config/converter/attribute/suggested-value",
"setSuggestedValue", 0);
digester.addCallMethod("faces-config/converter/attribute/attribute-extension",
"addAttributeExtension", 0);
digester.addObjectCreate("faces-config/converter/property",Property.class);
digester.addSetNext("faces-config/converter/property","addProperty");
digester.addCallMethod("faces-config/converter/property/description",
"addDescription", 0);
digester.addCallMethod("faces-config/converter/property/display-name",
"addDisplayName", 0);
digester.addCallMethod("faces-config/converter/property/icon",
"addIcon", 0);
digester.addCallMethod("faces-config/converter/property/property-name",
"setPropertyName", 0);
digester.addCallMethod("faces-config/converter/property/property-class",
"setPropertyClass", 0);
digester.addCallMethod("faces-config/converter/property/default-value",
"setDefaultValue", 0);
digester.addCallMethod("faces-config/converter/property/suggested-value",
"setSuggestedValue", 0);
digester.addCallMethod("faces-config/converter/property/property-extension",
"addPropertyExtension", 0);
to see what actual properties you can set onto the converter - this is
all taken out of some obscure appendix to the spec, which is not
binding (it is obviously just there for the fun of it, and is not
implemented by the RI).
regards,
Martin
On 9/1/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
> Excellent! I will definitely look into this.
> Is it documented anywhere other than code, or should I start work on
> that as well? :)
>
> On 9/1/05, Martin Marinschek <[EMAIL PROTECTED]> wrote:
> > ---------- Forwarded message ----------
> > From: Martin Marinschek <[EMAIL PROTECTED]>
> > Date: Sep 1, 2005 5:43 PM
> > Subject: Re: best way to initialize BackingBean?
> > To: Mike Kienenberger <[EMAIL PROTECTED]>
> >
> >
> > I am talking about exactly the same thing you are talking about.
> >
> > With a caveat - you can't use value bindings there right now, just
> > strings are possible. Ideally, you would take the code where it ends
> > end bring it a little further ;)
> >
> > regards,
> >
> > Martin
> >
> > On 9/1/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
> > > Martin,
> > >
> > > Are you talking about setting parameters at run-time via f:param?
> > >
> > > We're talking about setting them at config-time via managed properties.
> > >
> > > Like this:
> > >
> > >
> > > <converter>
> > > <converter-for-class>myClass</converter-for-class>
> > > <converter-class>myConverterClass</converter-class>
> > > <managed-property>
> > > <property-name>myManagedBean</property-name>
> > > <value>#{myManagedBeanName}</value>
> > > </managed-property>
> > > </converter>
> > >
> > >
> > > On 8/31/05, Martin Marinschek <[EMAIL PROTECTED]> wrote:
> > > > Hint, hint taken ;)
> > > >
> > > > MyFaces does that. It is in the appendix of the spec, and MyFaces (at
> > > > least partially - as much as was needed of that by me) supports
> > > > setting parameters onto Converters...
> > > >
> > > > regards,
> > > >
> > > > Martin
> > > >
> > > > On 8/31/05, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > > On 8/31/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
> > > > > > On 8/31/05, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> > > > > > > If you are using by-Class converters, you don't need to register
> > > > > > > them
> > > > > on
> > > > > > > the *component* at all -- they get registered in the Application
> > > > > instance
> > > > > > > along with the class they are for. I'm not sure I see a need to
> > > > > > > use a
> > > > > DI
> > > > > > > framework to instantiate those, since you already have the
> > > > > > > ability to
> > > > > > > configure the implementation class that will be used.
> > > > > >
> > > > > > Craig,
> > > > > >
> > > > > > Can you expand on this? What do I need to do to gain the ability to
> > > > > > configure the implementation class?
> > > > >
> > > > > Simply include a registration for the converter in one of your
> > > > > faces-config.xml files. The following entry will override the
> > > > > standard
> > > > > converer that is applied to any property of type Integer:
> > > > >
> > > > > <converter>
> > > > > <converter-for-class>java.lang.Integer</converter-for-class>
> > > > >
> > > > > <converter-class>com.mycompany.MyIntegerConverter</converter-class>
> > > > > </converter>
> > > > >
> > > > > Your config files are read *after* the JSF implementation has been
> > > > > configured, so this *replaces* the standard one.
> > > > >
> > > > > > I have lots of converters registered by class, and I want to DI a
> > > > > > managed JSF bean into each of them. How do I do this?
> > > > >
> > > > > In other words, you want to use DI for configuring properties on a
> > > > > by-class
> > > > > converter? That, sadly, isn't supported unless you were to override
> > > > > the
> > > > > Application instance provided by your JSF impementation (or if your
> > > > > JSF
> > > > > implementation provided this feature as part of its own
> > > > > implementation, hint
> > > > > hint :-). The technique I described doesn't reference any by-id or
> > > > > by-type
> > > > > registered converters ... it creates anonymous instances.
> > > > >
> > > > > But you don't *need* to use DI for this if your MyIntegerConverter
> > > > > class
> > > > > (see previous example) is already set up exactly the way you want it
> > > > > after
> > > > > the public zero-args constructor returns. All you need for that is
> > > > > the
> > > > > registration described above.
> > > > >
> > > > > > -Mike
> > > > > >
> > > > >
> > > > > Craig
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > http://www.irian.at
> > > > Your JSF powerhouse -
> > > > JSF Trainings in English and German
> > > >
> > >
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> > Your JSF powerhouse -
> > JSF Trainings in English and German
> >
> >
> > --
> >
> > http://www.irian.at
> > Your JSF powerhouse -
> > JSF Trainings in English and German
> >
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German