java reflection - how to get the name of a specific property

I have a question regarding java reflection.

I need some kind of way to get the name of a specific field in a java class. Something that will work like this:

class X{
   int x;

   String getNameOfProperty(Object o){

Then, when calling


I would like to get "x";

I have managed to get the fields of a class using


but then i don't have any link between the property and the Field object associated with it.


You can use Abstract Syntax Tree for this purpose. For Eclipse you can find details here.

You can also use following



Need Your Help

Chai exports are not found in Mocha test

javascript node.js mocha node-modules chai

I have created simple Mocha test. It works perfectly when Node "assert" module is used. I run it from command line (Mocha is installed as a global node module):

MVC:If ID is equal to zero

c# nopcommerce

what I've got is a edit page and a create page. That are two links in another page, I am trying to create a redirect when the user tries to press on the edit button, if there is no value in the id,...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.