× 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.



I have a rule, if it can be done without reflection then do it that way.

As performing the same operation in reflection takes more code and more CPU.

However the trade in CPU for reflection is more than made up for by its
extreme power.

I'd say if reflection will do what you want, and there isn't a way to do it
without reflection then..... get reflecting.

When I am using reflection I always try to cast any objects that I have
created to an Interface as this means I can use the well known properties on
that object in an early bound manner.

Have fun.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of James Perkins
Sent: 13 May 2009 17:28
To: Java Programming on and around the iSeries / AS400
Subject: Reflection Usage

Hi All,
I am working on a project to perform a search over a Lucene index. I have
created a bean that will be used to store the information for the index.

I want to make the classes that create the index and search the index as
generic as possible. I had an idea to use reflection to set the values for
the fields in the bean. This would allow me to add fields to the bean
without having to change the index classes.

So the question is, would this be an appropriate use for reflection? I've
never really used reflection before so I don't want to go down this path and
find out I was wrong later.

Also, anybody looking for a good search engine, Lucene is brilliant.

Thank in advance,
--
James R. Perkins

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.