Jon Stevens wrote:
> 
> on 9/27/01 10:54 AM, "J Kary" <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> >
> > I've been reading through the Intake docs and I was wondering about the
> > 'mapToObject' attribute.
> >
> > 1) When mapping a group to an object do all the fields have to map to
> > that object?
> 
> Yes. (keep reading)
> 

No.  The mapToObject attribute on <group> sets the default object for
all the fields in the group.  There is a mapToObject attribute on
<field> that can be used instead of or to override the one in group.  If
a particular field does not map to an object's property but you have
defined a default mapToObject for the group, you can turn off the
default behavior of assuming that object contains a property matching
the field name by using <field mapToProperty=""...

Using multiple objects per group is possible though not tested and there
may be some inconsistencies, as the behavior has not been completely
defined.

> > 2) If so, then I guess the mapToProperty for a field is only good for
> > mapping a form name to _different_ object field name.  If the attribute
> > is not there, then the field name is assumed to be the property name.
> > (Correct?)
> 
> No mapToProperty is more like an alias. Example:

What Jason says above sounds right to me, though your description of the
behavior below is also correct.

john mcnally

> 
>  <field name="Name" key="name" type="String">
>  </field>
> 
>  <field name="NewName" key="newname" type="String"
>                mapToProperty="Name">
>  </field>
> 
> That would map NewName to the set/getName() method in the Bean.
> 
> > I think I may have misunderstood the document as allowing you to
> > specifically select where fields in the group would map to the group's
> > object.
> 
> I don't think I understand what you are misunderstanding.
> 
> Essentially, the intake .xml file allows you to map specific Fields to an
> Object's methods with the addition of being able to also create aliases
> using the mapToProperty attribute.
> 
> -jon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to