jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Java reflection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "Java reflection" Watch "Java reflection" New topic

Java reflection

Shenaz Assu
Ranch Hand

Joined: Sep 21, 2007
Posts: 32
Hi All,

I am new to java reflection. I have a Class c variable. I need to check if its an instance of Number.class. If so, i'll need to invoke anyone of the constructors of the subclasses of Number (Long, Double, etc..) depending upon the variable c. Is it possible using the reflection.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14952

Have a look at the API documentation of class Class. Try something like this:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Have you checked out Aspose?
subject: Java reflection
It's not a secret anymore!