× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Sorry, minor error.
You'd have to use getDeclaredFields() to get a hold of private and
protected data. getFields() only returns publicly available fields.

You can also use this along with a traversal of the object's superclasses
to get any inherited protected fields.





                                                                                
                                                        
                      MarkB@xxxxxxxxxx                                          
                                                        
                      Sent by:                  To:       RPG programming on 
the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>                
                      rpg400-l-bounces@x        cc:                             
                                                        
                      idrange.com               Subject:  RE: back to: 
improving rpg.  was: what is object oriented programming         
                                                                                
                                                        
                                                                                
                                                        
                      08/05/2003 04:14                                          
                                                        
                      PM                                                        
                                                        
                      Please respond to                                         
                                                        
                      RPG programming on                                        
                                                        
                      the AS400 /                                               
                                                        
                      iSeries                                                   
                                                        
                                                                                
                                                        
                                                                                
                                                        





Any good OO language allows at least some level of "meta" programming.
In Java its reflection:

 void showFields(Object o)
    {
        Field[] fields = o.getClass().getFields();
        for (int i = 0; i<fields.length; i++)
        {
            Field field = fields[i];
            field.setAccessible(true);
            try
            {
                System.out.println("A  (possibly private) private field is
"
                                                     + field.get(o));
                field.set(o, a_new_value_for_a_private_field);
            } catch (IllegalAccessException e)
            {
                e.printStackTrace();
            }
        }
    }








As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.