Is there a way to pass a class into a property as a Class object?
i.e.
<managed-property>
<property-name>clazz</property-name>
<value>java.lang.Double.class</value>
</managed-property>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no way. This is only possible if the class in question has a (default) no-arg constructor. The
java.lang.Doubledoesn’t have one. Also, in theory your construct is invalid. The following would have worked if you use a class with a (default) no-arg constructor at the place wherejava.lang.Doubleis been definied:in combination with
You really need to specify it as a
Stringand make use ofClass#forName()to obtain thejava.lang.Classfrom it. Here’s a kickoff example:in combination with