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



Thanks Neill,
That was kind of what I had been reading. I've never really had the need for
reflection before, but it is very interesting and powerful.

I might go with storing the data in a Map with a descriptive enum as the
key. I think in this case that might be a bit more desirable. I did get a
working reflection though. It does however seem a bit slow, but it works
great!

Thanks for the input!

--
James R. Perkins


On Wed, May 13, 2009 at 11:56, Neill Harper <neill.harper@xxxxxxxx> wrote:

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
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



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.