title: How to pass object to another class with the setup I have?
body: <p>I have a class like this </p>
  
  <pre><code>public class TypeUtil {
  
      private static final TypeUtil s_instance = new TypeUtil();
  
      public static TypeUtil getInstance() {
          return s_instance;
      }
  
      private TypeUtil() {
  
      }
  
      public void metadata() {
          // some code here
          // and use some_object value here only not in isAlpha
      }
  
      public boolean isAlpha(String value) {
  
      }   
  }
  </code></pre>
  
  <p>And which I am using to call metadata class like this</p>
  
  <pre><code>TypeUtil util = TypeUtil.getInstance();
  util.metadata();
  </code></pre>
  
  <p>Similarly, I am using above TypeUtil class to call isAlpha method like this -</p>
  
  <pre><code>TypeUtil.getInstance().isAlpha(some_value);
  </code></pre>
  
  <p><strong>Problem Statement:-</strong></p>
  
  <p>Now what I am trying to do is - I need to pass one object to <code>TypeUtil</code> constructor, and which I need to use in <code>metadata</code> method. With the above code, how can I do that?</p>
  
  <p>Is this ok to do like this? or is there any better way of doing it?</p>
  
  <pre><code>TypeUtil util = TypeUtil.getInstance(some_object);
  util.metadata();
  </code></pre>
  
  <p>And then in the getInstance method of TypeUtil class assign this some_object value to some_variable object?</p>
  
  <p>If yes, then how would I call isAlpha method? Bcoz for that, I don't want to pass any object to the constructor for calling it.</p>