velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: AW: introspection 'enhancement'
Date Fri, 02 Feb 2001 12:20:00 GMT
<nibble, nibble.... tug>

(And lets stop posting to both -user and -dev... )

Christoph Reck wrote:
> 
> > I don't think the bean spec actually states this, but if you can tell me
> > where, I would be happy to know.
> >
> > We *infer* this, but as far as I can tell, it doesn't say it.
> 
> Section 8.3 of beans_101.pdf (http://java.sun.com/beans/docs/spec.html)
> states:
>         "If we discover a matching pair of get<PropertyName> and
>          set<PropertyName> methods that take and return the same
>          type, then we regard these methods as defining a read-write
>          property whose name will be <propertyName>. We will use the
>          get<PropertyName> method get the property value and the
>          set<PropertyName> method to set the property value. The pair
>          of methods may be located either in the same class or one may
>          be in a base class and the other may be in a derived class.
> 
>          If we find only one of these methods, then we regard it as
>          defining either a read-only or a write-only property called
>          <propertyName>"
> 
> It clearly differentiates between set<PropertyName> and <propertyName>
> where the case of the first letter is different. This is standard
> Java coding convention. The JavaBean specification just uses the
> convention without needing to say this explicetely.

Right!  We *infer* it from the Java coding convention.  Like I said -
this points to the direction of finding a set of methods  set<Propname>
and get<Propname> to infer a property  <propname>  (see section 8.8
also).

We go the other direction, having a <propname> and then search for a
matching getter / setter.

I do agree that we should support this pattern.  I was only arguing that
that the spec doesn't actually spell out what we infer.

> If somebody
> does not follow the Java and bean conventions, it is not a JavaBean
> and tools will not to work according with the bean spec on it.

Right.  But we don't require that objects in the context are beans... 
It's helpful, but not required.
 
> In a separate mail on this I said the users of non-bean setter
> methods can call the method explicetly.

I disagree, and responded to that post, so won't repeat it here.
 
> :) Christoph

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Mime
View raw message