Juha-P Lindfors writes:
 > 
 > Hi,
 > 
 > On Thu, 14 Sep 2000, Ingo Bruell wrote:
 > > Hi,
 > > 
 > > > immidiately found out why my Bean wouldn't deploy. I had to declare all
 > > > CMP managed fields as public, not as private. Why is that ? I thought
 > > > they should only be accessed through the set/get methods. Seems like I
 > > > have to read the specs again ...
 > > 
 > > if i have understood the documentation from the java Reflection API right,
 > > the API could only access public attributes from a class. And the container
 > > should also have access to the attributes to map the stored attributes to
 > > the bean attributes (with the reflection API)...
 > 
 > getDeclaredFields() would return all fields, including private, right?
 > 
 > Anyhow, with EJB2.0 all access to CMP fields will go through accessor
 > methods, so it would seem that at least then it is not necessary to keep
 > these fields public (though the spec draft doesn't change the requirements
 > for this, CMP fields are still required to be public).
 > 
 > Not sure why this requirement was made in the first place. Although since
 > the container is the only one accessing the bean class I guess it doesn't
 > make that much difference but still it seems to go against the coding
 > practice many OO programmers use.

In particular it causes problems when one field is not stored in a
variable but is always calculated. Perhaps this is bad design, but
that's how it seems to work sometimes.

Tom
-- 
Tom Cook - Software Engineer

"We rarely find that people have good sense unless they agree
 with us."
                - Francois, Duc de la Rochefoucauld

LISAsoft Pty Ltd - www.lisa.com.au

--------------------------------------------------
38 Greenhill Rd.          Level 3, 228 Pitt Street
Wayville, SA, 5034        Sydney, NSW, 2000

Phone:   +61 8 8272 1555  Phone:   +61 2 9283 0877
Fax:     +61 8 8271 1199  Fax:     +61 2 9283 0866
--------------------------------------------------


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to