public static NamingConvention determineNamingConvention ( TypeElement type , Iterable < ExecutableElement > methods , Messager messager , Types types ) { ExecutableElement beanMethod = null ; ExecutableElement prefixlessMethod = null ; for ( ExecutableElement method : methods ) { switch ( methodNameConvention ( method ) ) { case BEAN : beanMethod = firstNonNull ( beanMethod , method ) ; break ; case PREFIXLESS : prefixlessMethod = firstNonNull ( prefixlessMethod , method ) ; break ; default : break ; } } if ( prefixlessMethod != null ) { if ( beanMethod != null ) { messager . printMessage ( ERROR , "Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '" + beanMethod . getSimpleName ( ) + "' and '" + prefixlessMethod . getSimpleName ( ) + "'" , type ) ; } return new PrefixlessConvention ( messager , types ) ; } else { return new BeanConvention ( messager , types ) ; } }
Determine whether the user has followed bean - like naming convention or not .