Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to retrieve the values from the java class file into velocity template file using the field methodizer?

Jayashree Shetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2014

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".

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2014

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

Jayashree Shetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2014

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.

TAGS
AUG Leaders

Atlassian Community Events