title: How to call a method every time a variable is called
body: <p>So I have a variable that uses a method. Something like this:</p>
  
  <pre><code>By locator = By.id("something-"+getDynamicId());
  </code></pre>
  
  <p>Usually the id changes numbers like this: something-1 to something-2 (not those exact numbers, always different). I have a way of getting the number it changes to by calling the getDynamicId() method. The problem is, when I start my test the id is set at the start and whenever I click on a specific button, the id changes but my variable does not. Is it possible for the <em>locator</em> variable to call getDynamicId() everytime <em>locator</em> is called? Maybe everytime I click on the specific button the locator reloads?</p>
  
  <p>I have looked up ClassLoaders but I do not know how to use it nor do I know if it can even do what I want.</p>