title: Fetch all string value pair from Constant.java File
body: <p>I have an existing <code>Constant.java</code> using which I have to write a logic so that if input string contains any of the constant string then do something. </p>
  
  <pre><code> public class Constants {
  
      public static final String CONSTANT_ONE = "VALUE_CONSTANT_ONE";
      public static final String CONSTANT_TWO = "VALUE_CONSTANT_TWO";
      //and so on..
  }
  </code></pre>
  
  <p><code>Validate.checkPhrase()</code> is a Boolean method that accepts input string and constants strings as argument, converts them to lower case and passes output to <code>java.lang.String.contains()</code> method to validate.</p>
  
  <p>In my main logic I am using if with multiple conditions </p>
  
  <pre><code>if (Validate.checkPhrase(str,CONSTANT_ONE) 
  || Validate.checkPhrase(str,CONSTANT_TWO)|| /* multiple checks */ ){
  //do something
  }
  </code></pre>
  
  <p>Every time a new constant is added, I have to manually add it to the <code>if condition</code> as well.
  Is there a way I can fetch all string,value pair from <code>Constant.java</code>  and use that in my logic.</p>