Solved

PropertyDescriptor - getting declared field names

Posted on 2007-03-30
2
406 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
2 Comments
 
LVL 30

Accepted Solution

by:
mayankeagle earned 250 total points
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hash value 2 38
Updating Java 9 85
strCopies  challenge 17 73
github account with ecipse 1 14
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now