logo       

Re: addJavaBeanMethods: msg#00041

lang.scala

Subject: Re: addJavaBeanMethods

On Fri, 2006-02-10 at 08:27 -0800, joel@xxxxxxxxxxxx wrote:
> I'd definitely vote to have it capitalize the initial character. That would
> certainly be the Java way, and this is intended purely for Java anyway.

We could have a separate attribute that does the same as BeanProperty
but with capitalization. I'm just kidding. But once you get locked in a
serious attribute collection, the tendency is to push it as far as you
can...

Seriously, what you suggest is easy to arrange. But I'm having seconds
thoughts on the way I implemented it. My primary concern is what happens
if, say, getMyProperty already exists. Obviously, we cannot introduce
new methods without making sure we're not stepping on someone else's
toes. This should be handled as early as possible. In any case, I don't
think the code generator should perform any lookups.

> Although, there isn't a way to specify (public/protected/private/pkg)
> is there?

> ie.
>
> class X {
> private String name;
>
> public String getName();
> public void setName(String val);

Not sure what you mean. If you declare a variable in Scala it is
transformed in sth like the code above (modulo the naming convention).
The quirk is that you don't have direct access to the private field.

As far as user definitions are concerned, you can declare them as public
(no access modifiers), protected or private. In addition, Scala2 allows
you to make definitions private to a particular enclosing class or
package (although this is only enforced at Scala level - the emitted
method is public). You can find more details in

http://scala.epfl.ch/nsc/files/Changes.pdf

Nikolay




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise