I have a java class file which has a static variable . I need to access this value into a velocity template file . i read that field methodizer does it. i have used this but it returns null evrytime.
public class DueDateIndicator { public static String methodvalue = "10"; @Override public Map<String, Object> getContextMap(User user, JiraHelper jiraHelper) { FieldMethodizer methodizer = new FieldMethodizer("com.example.plugins.tutorial.DueDateIndicator" ); map.put("duedateindicatorvalue", methodvalue); System.out.println("The value of the count is :" + methodizer.get(methodvalue)); }
The value prints on the console as "null".
Community moderators have prevented the ability to post new answers.
Seems over complex to me. Have you tried the absolute basic test first?
String myTest = "Hello world!" ;
map.put ("myteststring", myTest);
Then in the velocity,
$myteststring
Thanks Nic.. I realized that i really made it complex by using the fieldmethodizer after posting this question later. I was about to write it as a comment that instead we could use the basic assignment . By the time read your post :) Thank you. It did work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.