 <p>Just use the built-in <code>isName</code> method:</p> <pre><code>public static boolean isName(CharSequence name) </code></pre> <p>This returns whether or not a name is a syntactically valid qualified name in the latest source version.</p> <p>See the <a href="http://docs.oracle.com/javase/8/docs/api/javax/lang/model/SourceVersion.html#isName-java.lang.CharSequence-" rel="nofollow">isName()</a> documentation.</p>