public static ExecutableElement getNoArgsConstructor(TypeElement type) {
    for (Element enclosed : type.getEnclosedElements()) {
      if (enclosed.getKind() != ElementKind.CONSTRUCTOR) {
        continue;
      }
      ExecutableElement constructor = (ExecutableElement) enclosed;
      if (constructor.getParameters().isEmpty()) {
        return constructor;
      }
    }
    return null;
  }
public static ExecutableElement getNoArgsConstructor ( TypeElement type ) { for ( Element enclosed : type . getEnclosedElements ( ) ) { if ( enclosed . getKind ( ) != ElementKind . CONSTRUCTOR ) { continue ; } ExecutableElement constructor = ( ExecutableElement ) enclosed ; if ( constructor . getParameters ( ) . isEmpty ( ) ) { return constructor ; } } return null ; }
Returns the no-args constructor for {@code type}, or null if no such
constructor exists.