protected boolean checkIfClassHasNoargsConstructor ( TypeElement typeElement ) { // check if annotated class has noargs constructor boolean foundConstructor = false ; boolean foundNoargsConstructor = false ; for ( Element child : typeElement . getEnclosedElements ( ) ) { if ( ElementKind . CONSTRUCTOR . equals ( child . getKind ( ) ) ) { foundConstructor = true ; ExecutableElement constructor = ( ExecutableElement ) child ; if ( constructor . getParameters ( ) . size ( ) == 0 ) { foundNoargsConstructor = true ; break ; } } } return ! ( foundConstructor && ! foundNoargsConstructor ) ; }
Checks if class has noargs constructor or default noargs constructor .