ClassTypeParameterName
Since Checkstyle 5.0
Description
          Checks that class type parameter names conform to a specified pattern.
        
      Properties
| name | description | type | default value | since | 
|---|---|---|---|---|
| format | Sets the pattern to match valid identifiers. | Pattern | "^[A-Z]$" | 
              
5.0 | 
Examples
To configure the check:
<module name="Checker">
  <module name="TreeWalker">
    <module name="ClassTypeParameterName"/>
  </module>
</module>
Example:
class Example1 {
  class MyClass1<T> {}
  class MyClass2<t> {}        // violation 'Name 't' must match pattern'
  class MyClass3<abc> {}      // violation 'Name 'abc' must match pattern'
  class MyClass4<LISTENER> {} // violation 'Name 'LISTENER' must match pattern'
  class MyClass5<RequestT> {} // violation 'Name 'RequestT' must match pattern'
}
To configure the check for names that are uppercase word:
<module name="Checker">
  <module name="TreeWalker">
    <module name="ClassTypeParameterName">
      <property name="format" value="^[A-Z]{2,}$"/>
    </module>
  </module>
</module>
Example:
class Example2 {
  class MyClass1<T> {}        // violation 'Name 'T' must match pattern'
  class MyClass2<t> {}        // violation 'Name 't' must match pattern'
  class MyClass3<abc> {}      // violation 'Name 'abc' must match pattern'
  class MyClass4<LISTENER> {}
  class MyClass5<RequestT> {} // violation 'Name 'RequestT' must match pattern'
}
To configure the check for names that are camel case word with T as suffix (Google Style):
<module name="Checker">
  <module name="TreeWalker">
    <module name="ClassTypeParameterName">
      <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
    </module>
  </module>
</module>
Example:
class Example3 {
  class MyClass1<T> {}
  class MyClass2<t> {}        // violation 'Name 't' must match pattern'
  class MyClass3<abc> {}      // violation 'Name 'abc' must match pattern'
  class MyClass4<LISTENER> {} // violation 'Name 'LISTENER' must match pattern'
  class MyClass5<RequestT> {}
}
Example of Usage
Violation Messages
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
Package
com.puppycrawl.tools.checkstyle.checks.naming






