What's the best way to pass a String as a separate type?
<p>I want to create a method like <code>example</code> below to make sure that a user is only able to provide a value that corresponds to one of the constants defined in the <code>Name</code> class:</p>

<pre><code>public class Name{
 public static String JOHN = "John";
 public static String MARY = "Mary";
 public static String TAB = "\t";
}

public void example(Name name){
 test(name);
}

public void test(String name){
 System.out.println(name);
}
</code></pre>

<p>Basically the <code>example</code> method just takes a <code>String</code> argument. But I want to restrict the types of Strings that could be passed by the user so if I make the parameter <code>String name</code> it will be open to any type of input.</p>

<p>Is there a simpler way to do this?</p>
