how to get a constant in java with class

Posted by vincent on Stack Overflow See other posts from Stack Overflow or by vincent
Published on 2010-05-19T10:26:05Z Indexed on 2010/05/19 10:30 UTC
Read the original article Hit count: 196

Filed under:
|
|
|

basically I need to get a constant for a class however I have no instance of the object but only its class. In PHP I would do constant(XYZ); Is there a similar way of retrieving a constant in JAVA?

I need it to facilitate a dynamic getMethod call

Class parameterType = Class.forName(class_name);
object.setProperty(field name, field value, parameterType);

the set property method would then get the correct method and set the specified property, however I cant get a method which has int as parameter type without using Interger.TYPE

© Stack Overflow or respective owner

Related posts about java

Related posts about constants