?
Solved

PropertyDescriptor - getting declared field names

Posted on 2007-03-30
2
Medium Priority
?
477 Views
Last Modified: 2008-02-26
Hi Experts,

If I use PropertyDescriptor, is there any way that I can get declared field names (not setter/getter method names)?

PropertyDescriptor pd[] = PropertyUtils.getPropertyDescriptors(aForm);

aForm is ActionForm and I want to get all the fields in that class.

thx,
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
Mayank S earned 1000 total points
ID: 18825542
Declared field names will be private. You will have to derive the names I guess. Obtain a list of all getters. If a method is called getName (), then remove out the 'get' and change the case of the first character to make it 'name' and that would be the name of the property. Same way, for boolean properties, it could be like isValid ()
0
 

Author Comment

by:dkim18
ID: 18825838
I used getName() and I got what I wanted. Somehow, I applied getName() by using java.lang.reflect.Method variable and getting method name and I was wondering. My bad...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question