default boolean ifDocument(Consumer<Document> consumer){
  if (isDocument()) {
    consumer.accept(asDocument());
    return true;
  }
  return false;
}

default boolean ifDocument ( Consumer < Document > consumer ) { if ( isDocument ( ) ) { consumer . accept ( asDocument ( ) ) ; return true ; } return false ; }
if a value is a document , invoke the specified consumer with the value , otherwise do nothing .
