signature:
public class Document { /** * Gets the value in an embedded document , casting it to the given { @ code Class < T > } or returning the default value if null .
 * The list of keys represents a path to the embedded value , drilling down into an embedded document for each key .
 * This is useful to avoid having casts in client code , though the effect is the same .
 * The generic type of the keys list is { @ code ? } to be consistent with the corresponding { @ code get } methods , but in practice
 * the actual type of the argument should be { @ code List < String > } . So to get the embedded value of a key list that is of type String ,
 * you would write { @ code String name = doc . getEmbedded ( List . of ( " employee " , " manager " , " name " ) , " John Smith " ) } instead of
 * { @ code String name = doc . get ( " employee " , Document . class ) . get ( " manager " , Document . class ) . get ( " name " , " John Smith " ) } .
 * @ param keys the list of keys
 * @ param defaultValue what to return if the value is null
 * @ param < T > the type of the class
 * @ return the value of the given key , or null if the instance does not contain this key .
 * @ throws ClassCastException if the value of the given key is not of type T
 * @ since 3.10 */
public < T > T getEmbedded ( final List < ? > keys , final T defaultValue ) { } }

implementation: notNull ( "keys" , keys ) ; isTrue ( "keys" , ! keys . isEmpty ( ) ) ; notNull ( "defaultValue" , defaultValue ) ; return getEmbeddedValue ( keys , null , defaultValue ) ;


signature:
public class Document { /** * Throws ClassCastException if any of the intermediate embedded values is not a Document . */
@ SuppressWarnings ( "unchecked" ) private < T > T getEmbeddedValue ( final List < ? > keys , final Class < T > clazz , final T defaultValue ) { } }

implementation: Object value = this ; Iterator < ? > keyIterator = keys . iterator ( ) ; while ( keyIterator . hasNext ( ) ) { Object key = keyIterator . next ( ) ; value = ( ( Document ) value ) . get ( key ) ; if ( ! ( value instanceof Document ) ) { if ( value == null ) { return defaultValue ; } else if ( keyIterator . hasNext ( ) ) { throw new ClassCastException ( format ( "At key %s, the value is not a Document (%s)" , key , value . getClass ( ) . getName ( ) ) ) ; } } } return clazz != null ? clazz . cast ( value ) : ( T ) value ;


signature:
public class Document { /** * Gets the list value of the given key , casting the list elements to the given { @ code Class < T > } . This is useful to avoid having
 * casts in client code , though the effect is the same .
 * @ param key the key
 * @ param clazz the non - null class to cast the list value to
 * @ param < T > the type of the class
 * @ return the list value of the given key , or null if the instance does not contain this key .
 * @ throws ClassCastException if the elements in the list value of the given key is not of type T or the value is not a list
 * @ since 3.10 */
public < T > List < T > getList ( final Object key , final Class < T > clazz ) { } }

implementation: notNull ( "clazz" , clazz ) ; return constructValuesList ( key , clazz , null ) ;


signature:
public class Document { /** * Gets the list value of the given key , casting the list elements to { @ code Class < T > } or returning the default list value if null .
 * This is useful to avoid having casts in client code , though the effect is the same .
 * @ param key the key
 * @ param clazz the non - null class to cast the list value to
 * @ param defaultValue what to return if the value is null
 * @ param < T > the type of the class
 * @ return the list value of the given key , or the default list value if the instance does not contain this key .
 * @ throws ClassCastException if the value of the given key is not of type T
 * @ since 3.10 */
public < T > List < T > getList ( final Object key , final Class < T > clazz , final List < T > defaultValue ) { } }

implementation: notNull ( "defaultValue" , defaultValue ) ; notNull ( "clazz" , clazz ) ; return constructValuesList ( key , clazz , defaultValue ) ;


signature:
public class Document { /** * A ClassCastException will be thrown if an element in the list is not of type T . */
@ SuppressWarnings ( "unchecked" ) private < T > List < T > constructValuesList ( final Object key , final Class < T > clazz , final List < T > defaultValue ) { } }

implementation: List < ? > value = get ( key , List . class ) ; if ( value == null ) { return defaultValue ; } for ( Object item : value ) { if ( ! clazz . isAssignableFrom ( item . getClass ( ) ) ) { throw new ClassCastException ( format ( "List element cannot be cast to %s" , clazz . getName ( ) ) ) ; } } return ( List < T > ) value ;


signature:
public class Document { /** * Gets a JSON representation of this document
 * @ param writerSettings the json writer settings to use when encoding
 * @ param encoder the document codec instance to use to encode the document
 * @ return a JSON representation of this document
 * @ throws org . bson . codecs . configuration . CodecConfigurationException if the registry does not contain a codec for the document values . */
public String toJson ( final JsonWriterSettings writerSettings , final Encoder < Document > encoder ) { } }

implementation: JsonWriter writer = new JsonWriter ( new StringWriter ( ) , writerSettings ) ; encoder . encode ( writer , this , EncoderContext . builder ( ) . isEncodingCollectibleDocument ( true ) . build ( ) ) ; return writer . getWriter ( ) . toString ( ) ;


signature:
public class TransactionOptions { /** * Merge the two provided transaction options , with the first taking precedence over the second .
 * @ param options the transaction options , which take precedence for any property that is non - null
 * @ param defaultOptions the default transaction options
 * @ return the merged transaction options */
public static TransactionOptions merge ( final TransactionOptions options , final TransactionOptions defaultOptions ) { } }

implementation: notNull ( "options" , options ) ; notNull ( "defaultOptions" , defaultOptions ) ; return TransactionOptions . builder ( ) . writeConcern ( options . getWriteConcern ( ) == null ? defaultOptions . getWriteConcern ( ) : options . getWriteConcern ( ) ) . readConcern ( options . getReadConcern ( ) == null ? defaultOptions . getReadConcern ( ) : options . getReadConcern ( ) ) . readPreference ( options . getReadPreference ( ) == null ? defaultOptions . getReadPreference ( ) : options . getReadPreference ( ) ) . build ( ) ;


signature:
public class QuickTour { /** * Run this main method to see the output of this quick example .
 * @ param args takes an optional single argument for the connection string
 * @ throws InterruptedException if a latch is interrupted */
public static void main ( final String [ ] args ) throws InterruptedException { } }

implementation:
MongoClient mongoClient ; if ( args . length == 0 ) { // connect to the local database server
mongoClient = MongoClients . create ( ) ; } else { mongoClient = MongoClients . create ( args [ 0 ] ) ; } // get handle to " mydb " database
MongoDatabase database = mongoClient . getDatabase ( "mydb" ) ; // get a handle to the " test " collection
final MongoCollection < Document > collection = database . getCollection ( "test" ) ; // drop all the data in it
final CountDownLatch dropLatch = new CountDownLatch ( 1 ) ; collection . drop ( new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { dropLatch . countDown ( ) ; } } ) ; dropLatch . await ( ) ; // make a document and insert it
Document doc = new Document ( "name" , "MongoDB" ) . append ( "type" , "database" ) . append ( "count" , 1 ) . append ( "info" , new Document ( "x" , 203 ) . append ( "y" , 102 ) ) ; collection . insertOne ( doc , new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { System . out . println ( "Inserted!" ) ; } } ) ; // get it ( since it ' s the only one in there since we dropped the rest earlier on )
collection . find ( ) . first ( new SingleResultCallback < Document > ( ) { @ Override public void onResult ( final Document document , final Throwable t ) { System . out . println ( document . toJson ( ) ) ; } } ) ; // now , lets add lots of little documents to the collection so we can explore queries and cursors
List < Document > documents = new ArrayList < Document > ( ) ; for ( int i = 0 ; i < 100 ; i ++ ) { documents . add ( new Document ( "i" , i ) ) ; } final CountDownLatch countLatch = new CountDownLatch ( 1 ) ; collection . insertMany ( documents , new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { collection . countDocuments ( new SingleResultCallback < Long > ( ) { @ Override public void onResult ( final Long count , final Throwable t ) { System . out . println ( "total # of documents after inserting 100 small ones (should be 101) " + count ) ; countLatch . countDown ( ) ; } } ) ; } } ) ; countLatch . await ( ) ; // find first
SingleResultCallback < Document > printDocument = new SingleResultCallback < Document > ( ) { @ Override public void onResult ( final Document document , final Throwable t ) { System . out . println ( document . toJson ( ) ) ; } } ; collection . find ( ) . first ( printDocument ) ; // lets get all the documents in the collection and print them out
Block < Document > printDocumentBlock = new Block < Document > ( ) { @ Override public void apply ( final Document document ) { System . out . println ( document . toJson ( ) ) ; } } ; SingleResultCallback < Void > callbackWhenFinished = new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { System . out . println ( "Operation Finished!" ) ; } } ; collection . find ( ) . forEach ( printDocumentBlock , callbackWhenFinished ) ; // Query Filters
// now use a query to get 1 document out
collection . find ( eq ( "i" , 71 ) ) . first ( printDocument ) ; // now use a range query to get a larger subset
collection . find ( gt ( "i" , 50 ) ) . forEach ( printDocumentBlock , callbackWhenFinished ) ; // range query with multiple constraints
collection . find ( and ( gt ( "i" , 50 ) , lte ( "i" , 100 ) ) ) . forEach ( printDocumentBlock , callbackWhenFinished ) ; // Sorting
collection . find ( exists ( "i" ) ) . sort ( descending ( "i" ) ) . first ( printDocument ) ; // Projection
collection . find ( ) . projection ( excludeId ( ) ) . first ( printDocument ) ; // Aggregation
collection . aggregate ( asList ( match ( gt ( "i" , 0 ) ) , project ( Document . parse ( "{ITimes10: {$multiply: ['$i', 10]}}" ) ) ) ) . forEach ( printDocumentBlock , callbackWhenFinished ) ; collection . aggregate ( singletonList ( group ( null , sum ( "total" , "$i" ) ) ) ) . first ( printDocument ) ; // Update One
collection . updateOne ( eq ( "i" , 10 ) , set ( "i" , 110 ) , new SingleResultCallback < UpdateResult > ( ) { @ Override public void onResult ( final UpdateResult result , final Throwable t ) { System . out . println ( result . getModifiedCount ( ) ) ; } } ) ; // Update Many
collection . updateMany ( lt ( "i" , 100 ) , inc ( "i" , 100 ) , new SingleResultCallback < UpdateResult > ( ) { @ Override public void onResult ( final UpdateResult result , final Throwable t ) { System . out . println ( result . getModifiedCount ( ) ) ; } } ) ; // Delete One
collection . deleteOne ( eq ( "i" , 110 ) , new SingleResultCallback < DeleteResult > ( ) { @ Override public void onResult ( final DeleteResult result , final Throwable t ) { System . out . println ( result . getDeletedCount ( ) ) ; } } ) ; // Delete Many
collection . deleteMany ( gte ( "i" , 100 ) , new SingleResultCallback < DeleteResult > ( ) { @ Override public void onResult ( final DeleteResult result , final Throwable t ) { System . out . println ( result . getDeletedCount ( ) ) ; } } ) ; final CountDownLatch dropLatch2 = new CountDownLatch ( 1 ) ; collection . drop ( new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { dropLatch2 . countDown ( ) ; } } ) ; dropLatch2 . await ( ) ; // ordered bulk writes
List < WriteModel < Document > > writes = new ArrayList < WriteModel < Document > > ( ) ; writes . add ( new InsertOneModel < Document > ( new Document ( "_id" , 4 ) ) ) ; writes . add ( new InsertOneModel < Document > ( new Document ( "_id" , 5 ) ) ) ; writes . add ( new InsertOneModel < Document > ( new Document ( "_id" , 6 ) ) ) ; writes . add ( new UpdateOneModel < Document > ( new Document ( "_id" , 1 ) , new Document ( "$set" , new Document ( "x" , 2 ) ) ) ) ; writes . add ( new DeleteOneModel < Document > ( new Document ( "_id" , 2 ) ) ) ; writes . add ( new ReplaceOneModel < Document > ( new Document ( "_id" , 3 ) , new Document ( "_id" , 3 ) . append ( "x" , 4 ) ) ) ; SingleResultCallback < BulkWriteResult > printBatchResult = new SingleResultCallback < BulkWriteResult > ( ) { @ Override public void onResult ( final BulkWriteResult result , final Throwable t ) { System . out . println ( result ) ; } } ; collection . bulkWrite ( writes , printBatchResult ) ; final CountDownLatch dropLatch3 = new CountDownLatch ( 1 ) ; collection . drop ( new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { dropLatch3 . countDown ( ) ; } } ) ; dropLatch3 . await ( ) ; collection . bulkWrite ( writes , new BulkWriteOptions ( ) . ordered ( false ) , printBatchResult ) ; collection . find ( ) . forEach ( printDocumentBlock , callbackWhenFinished ) ; // Clean up
final CountDownLatch dropLatch4 = new CountDownLatch ( 1 ) ; collection . drop ( new SingleResultCallback < Void > ( ) { @ Override public void onResult ( final Void result , final Throwable t ) { dropLatch4 . countDown ( ) ; } } ) ; dropLatch4 . await ( ) ; // release resources
mongoClient . close ( ) ;


signature:
public class SaslPrep { /** * Return true if the given { @ code codepoint } is a prohibited character as defined by
 * < a href = " https : / / tools . ietf . org / html / rfc4013 # section - 2.3 " > RFC 4013 , Section 2.3 < / a > . */
static boolean prohibited ( final int codepoint ) { } }

implementation: return nonAsciiSpace ( ( char ) codepoint ) || asciiControl ( ( char ) codepoint ) || nonAsciiControl ( codepoint ) || privateUse ( codepoint ) || nonCharacterCodePoint ( codepoint ) || surrogateCodePoint ( codepoint ) || inappropriateForPlainText ( codepoint ) || inappropriateForCanonical ( codepoint ) || changeDisplayProperties ( codepoint ) || tagging ( codepoint ) ;


signature:
public class SaslPrep { /** * Return true if the given { @ code codepoint } is change display properties or deprecated characters as defined by
 * < a href = " https : / / tools . ietf . org / html / rfc3454 # appendix - C . 8 " > RFC 3454 , Appendix C . 8 < / a > . */
private static boolean changeDisplayProperties ( final int codepoint ) { } }

implementation: return codepoint == 0x0340 || codepoint == 0x0341 || codepoint == 0x200E || codepoint == 0x200F || codepoint == 0x202A || codepoint == 0x202B || codepoint == 0x202C || codepoint == 0x202D || codepoint == 0x202E || codepoint == 0x206A || codepoint == 0x206B || codepoint == 0x206C || codepoint == 0x206D || codepoint == 0x206E || codepoint == 0x206F ;


signature:
public class SaslPrep { /** * Return true if the given { @ code codepoint } is a non - character code point as defined by
 * < a href = " https : / / tools . ietf . org / html / rfc3454 # appendix - C . 4 " > RFC 3454 , Appendix C . 4 < / a > . */
private static boolean nonCharacterCodePoint ( final int codepoint ) { } }

implementation: return 0xFDD0 <= codepoint && codepoint <= 0xFDEF || 0xFFFE <= codepoint && codepoint <= 0xFFFF || 0x1FFFE <= codepoint && codepoint <= 0x1FFFF || 0x2FFFE <= codepoint && codepoint <= 0x2FFFF || 0x3FFFE <= codepoint && codepoint <= 0x3FFFF || 0x4FFFE <= codepoint && codepoint <= 0x4FFFF || 0x5FFFE <= codepoint && codepoint <= 0x5FFFF || 0x6FFFE <= codepoint && codepoint <= 0x6FFFF || 0x7FFFE <= codepoint && codepoint <= 0x7FFFF || 0x8FFFE <= codepoint && codepoint <= 0x8FFFF || 0x9FFFE <= codepoint && codepoint <= 0x9FFFF || 0xAFFFE <= codepoint && codepoint <= 0xAFFFF || 0xBFFFE <= codepoint && codepoint <= 0xBFFFF || 0xCFFFE <= codepoint && codepoint <= 0xCFFFF || 0xDFFFE <= codepoint && codepoint <= 0xDFFFF || 0xEFFFE <= codepoint && codepoint <= 0xEFFFF || 0xFFFFE <= codepoint && codepoint <= 0xFFFFF || 0x10FFFE <= codepoint && codepoint <= 0x10FFFF ;


signature:
public class SaslPrep { /** * Return true if the given { @ code ch } is a non - ASCII control character as defined by
 * < a href = " https : / / tools . ietf . org / html / rfc3454 # appendix - C . 2.2 " > RFC 3454 , Appendix C . 2.2 < / a > . */
private static boolean nonAsciiControl ( final int codepoint ) { } }

implementation: return 0x0080 <= codepoint && codepoint <= 0x009F || codepoint == 0x06DD || codepoint == 0x070F || codepoint == 0x180E || codepoint == 0x200C || codepoint == 0x200D || codepoint == 0x2028 || codepoint == 0x2029 || codepoint == 0x2060 || codepoint == 0x2061 || codepoint == 0x2062 || codepoint == 0x2063 || 0x206A <= codepoint && codepoint <= 0x206F || codepoint == 0xFEFF || 0xFFF9 <= codepoint && codepoint <= 0xFFFC || 0x1D173 <= codepoint && codepoint <= 0x1D17A ;


signature:
public class SaslPrep { /** * Return true if the given { @ code ch } is a " commonly mapped to nothing " character as defined by
 * < a href = " https : / / tools . ietf . org / html / rfc3454 # appendix - B . 1 " > RFC 3454,
 * Appendix B . 1 < / a > . */
private static boolean mappedToNothing ( final char ch ) { } }


signature:
public class ConcurrentPool { /** * call done when you are done with an object from the pool if there is room and the object is ok will get added
 * @ param t item to return to the pool
 * @ param prune true if the item should be closed , false if it should be put back in the pool */
@ Override public void release ( final T t , final boolean prune ) { } }

implementation: if ( t == null ) { throw new IllegalArgumentException ( "Can not return a null item to the pool" ) ; } if ( closed ) { close ( t ) ; return ; } if ( prune ) { close ( t ) ; } else { available . addLast ( t ) ; } releasePermit ( ) ;


signature:
public class ConcurrentPool { /** * Gets an object from the pool - will block if none are available
 * @ param timeout negative - forever 0 - return immediately no matter what positive ms to wait
 * @ param timeUnit the time unit of the timeout
 * @ return An object from the pool , or null if can ' t get one in the given waitTime
 * @ throws MongoTimeoutException if the timeout has been exceeded */
@ Override public T get ( final long timeout , final TimeUnit timeUnit ) { } }

implementation: if ( closed ) { throw new IllegalStateException ( "The pool is closed" ) ; } if ( ! acquirePermit ( timeout , timeUnit ) ) { throw new MongoTimeoutException ( String . format ( "Timeout waiting for a pooled item after %d %s" , timeout , timeUnit ) ) ; } T t = available . pollLast ( ) ; if ( t == null ) { t = createNewAndReleasePermitIfFailure ( false ) ; } return t ;


signature:
public class ConcurrentPool { /** * Clears the pool of all objects . */
@ Override public void close ( ) { } }

implementation: closed = true ; Iterator < T > iter = available . iterator ( ) ; while ( iter . hasNext ( ) ) { T t = iter . next ( ) ; close ( t ) ; iter . remove ( ) ; }


signature:
public class Aggregates { /** * Creates a $ bucket pipeline stage
 * @ param < TExpression > the groupBy expression type
 * @ param < Boundary > the boundary type
 * @ param groupBy the criteria to group By
 * @ param boundaries the boundaries of the buckets
 * @ return the $ bucket pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / bucket / $ bucket
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
public static < TExpression , Boundary > Bson bucket ( final TExpression groupBy , final List < Boundary > boundaries ) { } }

implementation: return bucket ( groupBy , boundaries , new BucketOptions ( ) ) ;


signature:
public class Aggregates { /** * Creates a $ bucket pipeline stage
 * @ param < TExpression > the groupBy expression type
 * @ param < TBoundary > the boundary type
 * @ param groupBy the criteria to group By
 * @ param boundaries the boundaries of the buckets
 * @ param options the optional values for the $ bucket stage
 * @ return the $ bucket pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / bucket / $ bucket
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
public static < TExpression , TBoundary > Bson bucket ( final TExpression groupBy , final List < TBoundary > boundaries , final BucketOptions options ) { } }

implementation: return new BucketStage < TExpression , TBoundary > ( groupBy , boundaries , options ) ;


signature:
public class Aggregates { /** * Creates a $ bucketAuto pipeline stage
 * @ param < TExpression > the groupBy expression type
 * @ param groupBy the criteria to group By
 * @ param buckets the number of the buckets
 * @ return the $ bucketAuto pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / bucketAuto / $ bucketAuto
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
public static < TExpression > Bson bucketAuto ( final TExpression groupBy , final int buckets ) { } }

implementation: return bucketAuto ( groupBy , buckets , new BucketAutoOptions ( ) ) ;


signature:
public class Aggregates { /** * Creates a $ bucketAuto pipeline stage
 * @ param < TExpression > the groupBy expression type
 * @ param groupBy the criteria to group By
 * @ param buckets the number of the buckets
 * @ param options the optional values for the $ bucketAuto stage
 * @ return the $ bucketAuto pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / bucketAuto / $ bucketAuto
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
public static < TExpression > Bson bucketAuto ( final TExpression groupBy , final int buckets , final BucketAutoOptions options ) { } }

implementation: return new BucketAutoStage < TExpression > ( groupBy , buckets , options ) ;


signature:
public class Aggregates { /** * Creates a $ lookup pipeline stage , joining the current collection with the one specified in from
 * using equality match between the local field and the foreign field
 * @ param from the name of the collection in the same database to perform the join with .
 * @ param localField the field from the local collection to match values against .
 * @ param foreignField the field in the from collection to match values against .
 * @ param as the name of the new array field to add to the input documents .
 * @ return the $ lookup pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / lookup / $ lookup
 * @ mongodb . server . release 3.2
 * @ since 3.2 */
public static Bson lookup ( final String from , final String localField , final String foreignField , final String as ) { } }

implementation: return new BsonDocument ( "$lookup" , new BsonDocument ( "from" , new BsonString ( from ) ) . append ( "localField" , new BsonString ( localField ) ) . append ( "foreignField" , new BsonString ( foreignField ) ) . append ( "as" , new BsonString ( as ) ) ) ;


signature:
public class Aggregates { /** * Creates a $ lookup pipeline stage , joining the current collection with the one specified in from using the given pipeline
 * @ param from the name of the collection in the same database to perform the join with .
 * @ param pipeline the pipeline to run on the joined collection .
 * @ param as the name of the new array field to add to the input documents .
 * @ return the $ lookup pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / lookup / $ lookup
 * @ mongodb . server . release 3.6
 * @ since 3.7 */
public static Bson lookup ( final String from , final List < ? extends Bson > pipeline , final String as ) { } }

implementation: return lookup ( from , null , pipeline , as ) ;


signature:
public class Aggregates { /** * Creates a $ lookup pipeline stage , joining the current collection with the one specified in from using the given pipeline
 * @ param < TExpression > the Variable value expression type
 * @ param from the name of the collection in the same database to perform the join with .
 * @ param let the variables to use in the pipeline field stages .
 * @ param pipeline the pipeline to run on the joined collection .
 * @ param as the name of the new array field to add to the input documents .
 * @ return the $ lookup pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / lookup / $ lookup
 * @ mongodb . server . release 3.6
 * @ since 3.7 */
public static < TExpression > Bson lookup ( final String from , @ Nullable final List < Variable < TExpression > > let , final List < ? extends Bson > pipeline , final String as ) { } }

implementation: return new LookupStage < TExpression > ( from , let , pipeline , as ) ;


signature:
public class Aggregates { /** * Creates a graphLookup pipeline stage for the specified filter
 * @ param < TExpression > the expression type
 * @ param from the collection to query
 * @ param startWith the expression to start the graph lookup with
 * @ param connectFromField the from field
 * @ param connectToField the to field
 * @ param as name of field in output document
 * @ return the $ graphLookup pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / graphLookup / $ graphLookup
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
public static < TExpression > Bson graphLookup ( final String from , final TExpression startWith , final String connectFromField , final String connectToField , final String as ) { } }

implementation: return graphLookup ( from , startWith , connectFromField , connectToField , as , new GraphLookupOptions ( ) ) ;


signature:
public class Aggregates { /** * Creates a graphLookup pipeline stage for the specified filter
 * @ param < TExpression > the expression type
 * @ param from the collection to query
 * @ param startWith the expression to start the graph lookup with
 * @ param connectFromField the from field
 * @ param connectToField the to field
 * @ param as name of field in output document
 * @ param options optional values for the graphLookup
 * @ return the $ graphLookup pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / graphLookup / $ graphLookup
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
public static < TExpression > Bson graphLookup ( final String from , final TExpression startWith , final String connectFromField , final String connectToField , final String as , final GraphLookupOptions options ) { } }

implementation: notNull ( "options" , options ) ; return new GraphLookupStage < TExpression > ( from , startWith , connectFromField , connectToField , as , options ) ;


signature:
public class Aggregates { /** * Creates a $ group pipeline stage for the specified filter
 * @ param < TExpression > the expression type
 * @ param id the id expression for the group , which may be null
 * @ param fieldAccumulators zero or more field accumulator pairs
 * @ return the $ group pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / group / $ group
 * @ mongodb . driver . manual meta / aggregation - quick - reference / # aggregation - expressions Expressions */
public static < TExpression > Bson group ( @ Nullable final TExpression id , final BsonField ... fieldAccumulators ) { } }

implementation: return group ( id , asList ( fieldAccumulators ) ) ;


signature:
public class Aggregates { /** * Creates a $ group pipeline stage for the specified filter
 * @ param < TExpression > the expression type
 * @ param id the id expression for the group , which may be null
 * @ param fieldAccumulators zero or more field accumulator pairs
 * @ return the $ group pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / group / $ group
 * @ mongodb . driver . manual meta / aggregation - quick - reference / # aggregation - expressions Expressions */
public static < TExpression > Bson group ( @ Nullable final TExpression id , final List < BsonField > fieldAccumulators ) { } }

implementation: return new GroupStage < TExpression > ( id , fieldAccumulators ) ;


signature:
public class Aggregates { /** * Creates a $ unwind pipeline stage for the specified field name , which must be prefixed by a { @ code ' $ ' } sign .
 * @ param fieldName the field name , prefixed by a { @ code ' $ ' sign }
 * @ param unwindOptions options for the unwind pipeline stage
 * @ return the $ unwind pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / unwind / $ unwind
 * @ mongodb . server . release 3.2
 * @ since 3.2 */
public static Bson unwind ( final String fieldName , final UnwindOptions unwindOptions ) { } }

implementation: notNull ( "unwindOptions" , unwindOptions ) ; BsonDocument options = new BsonDocument ( "path" , new BsonString ( fieldName ) ) ; Boolean preserveNullAndEmptyArrays = unwindOptions . isPreserveNullAndEmptyArrays ( ) ; if ( preserveNullAndEmptyArrays != null ) { options . append ( "preserveNullAndEmptyArrays" , BsonBoolean . valueOf ( preserveNullAndEmptyArrays ) ) ; } String includeArrayIndex = unwindOptions . getIncludeArrayIndex ( ) ; if ( includeArrayIndex != null ) { options . append ( "includeArrayIndex" , new BsonString ( includeArrayIndex ) ) ; } return new BsonDocument ( "$unwind" , options ) ;


signature:
public class Aggregates { /** * Creates a $ out pipeline stage using the specified collection name and options
 * @ param collectionName the collection name
 * @ param options the $ out stage options
 * @ return the $ out pipeline stage
 * @ mongodb . driver . manual reference / operator / aggregation / out / $ out
 * @ mongodb . server . release 2.6 */
public static Bson out ( final String collectionName , final AggregateOutStageOptions options ) { } }

implementation: notNull ( "collectionName" , collectionName ) ; notNull ( "options" , options ) ; return new OutStage ( collectionName , options ) ;


signature:
public class LazyBSONObject { /** * Pipe the raw bytes into the given output stream .
 * @ param os the output stream
 * @ return the number of bytes written
 * @ throws IOException any IOException thrown by the output stream */
public int pipe ( final OutputStream os ) throws IOException { } }

implementation: WritableByteChannel channel = Channels . newChannel ( os ) ; return channel . write ( getBufferForInternalBytes ( ) ) ;


signature:
public class LazyBSONObject { /** * Gets the entry set for all the key / value pairs in this { @ code BSONObject } . The returned set is immutable .
 * @ return then entry set */
public Set < Map . Entry < String , Object > > entrySet ( ) { } }

implementation: final List < Map . Entry < String , Object > > entries = new ArrayList < Map . Entry < String , Object > > ( ) ; BsonBinaryReader reader = getBsonReader ( ) ; try { reader . readStartDocument ( ) ; while ( reader . readBsonType ( ) != BsonType . END_OF_DOCUMENT ) { entries . add ( new AbstractMap . SimpleImmutableEntry < String , Object > ( reader . readName ( ) , readValue ( reader ) ) ) ; } reader . readEndDocument ( ) ; } finally { reader . close ( ) ; } return new Set < Map . Entry < String , Object > > ( ) { @ Override public int size ( ) { return entries . size ( ) ; } @ Override public boolean isEmpty ( ) { return entries . isEmpty ( ) ; } @ Override public Iterator < Map . Entry < String , Object > > iterator ( ) { return entries . iterator ( ) ; } @ Override public Object [ ] toArray ( ) { return entries . toArray ( ) ; } @ Override public < T > T [ ] toArray ( final T [ ] a ) { return entries . toArray ( a ) ; } @ Override public boolean contains ( final Object o ) { return entries . contains ( o ) ; } @ Override public boolean containsAll ( final Collection < ? > c ) { return entries . containsAll ( c ) ; } @ Override public boolean add ( final Map . Entry < String , Object > stringObjectEntry ) { throw new UnsupportedOperationException ( ) ; } @ Override public boolean remove ( final Object o ) { throw new UnsupportedOperationException ( ) ; } @ Override public boolean addAll ( final Collection < ? extends Map . Entry < String , Object > > c ) { throw new UnsupportedOperationException ( ) ; } @ Override public boolean retainAll ( final Collection < ? > c ) { throw new UnsupportedOperationException ( ) ; } @ Override public boolean removeAll ( final Collection < ? > c ) { throw new UnsupportedOperationException ( ) ; } @ Override public void clear ( ) { throw new UnsupportedOperationException ( ) ; } } ;


signature:
public class AsynchronousChannelHelper { /** * Converts a { @ link AsynchronousByteChannel } into a { @ link AsyncInputStream }
 * @ param asynchronousByteChannel the AsynchronousByteChannel
 * @ return the AsyncInputStream */
public static AsyncInputStream channelToInputStream ( final AsynchronousByteChannel asynchronousByteChannel ) { } }

implementation: notNull ( "asynchronousByteChannel" , asynchronousByteChannel ) ; return new AsyncInputStream ( ) { @ Override public void read ( final ByteBuffer dst , final SingleResultCallback < Integer > callback ) { asynchronousByteChannel . read ( dst , null , new CompletionHandler < Integer , Object > ( ) { @ Override public void completed ( final Integer result , final Object attachment ) { callback . onResult ( result , null ) ; } @ Override public void failed ( final Throwable exc , final Object attachment ) { callback . onResult ( null , exc ) ; } } ) ; } @ Override public void skip ( final long bytesToSkip , final SingleResultCallback < Long > callback ) { notNull ( "callback" , callback ) ; callback . onResult ( 0L , null ) ; } @ Override public void close ( final SingleResultCallback < Void > callback ) { try { asynchronousByteChannel . close ( ) ; callback . onResult ( null , null ) ; } catch ( Exception e ) { callback . onResult ( null , e ) ; } } } ;


signature:
public class AsynchronousChannelHelper { /** * Converts a { @ link AsynchronousFileChannel } into a { @ link AsyncOutputStream }
 * @ param asynchronousFileChannel the AsynchronousFileChannel
 * @ return the AsyncOutputStream */
public static AsyncOutputStream channelToOutputStream ( final AsynchronousFileChannel asynchronousFileChannel ) { } }

implementation: notNull ( "asynchronousByteChannel" , asynchronousFileChannel ) ; return new AsyncOutputStream ( ) { private int position = 0 ; @ Override public void write ( final ByteBuffer src , final SingleResultCallback < Integer > callback ) { asynchronousFileChannel . write ( src , position , null , new CompletionHandler < Integer , Object > ( ) { @ Override public void completed ( final Integer result , final Object attachment ) { position += result ; callback . onResult ( result , null ) ; } @ Override public void failed ( final Throwable exc , final Object attachment ) { callback . onResult ( null , exc ) ; } } ) ; } @ Override public void close ( final SingleResultCallback < Void > callback ) { try { asynchronousFileChannel . close ( ) ; callback . onResult ( null , null ) ; } catch ( IOException e ) { callback . onResult ( null , e ) ; } } } ;


signature:
public class CopyOnWriteMap { /** * < p > Creates a new { @ link CopyOnWriteMap } with an underlying { @ link HashMap } . < / p >
 * < p > This map has { @ link View . Type # STABLE stable } views . < / p > */
public static < K , V > CopyOnWriteMap < K , V > newHashMap ( ) { } }

implementation: Builder < K , V > builder = builder ( ) ; return builder . newHashMap ( ) ;


signature:
public class CopyOnWriteMap { /** * < p > Creates a new { @ link CopyOnWriteMap } with an underlying { @ link HashMap } using the supplied map as the initial values . < / p >
 * < p > This map has { @ link View . Type # STABLE stable } views . < / p > */
public static < K , V > CopyOnWriteMap < K , V > newHashMap ( final Map < ? extends K , ? extends V > map ) { } }

implementation: Builder < K , V > builder = builder ( ) ; return builder . addAll ( map ) . newHashMap ( ) ;


signature:
public class CopyOnWriteMap { /** * < p > Creates a new { @ link CopyOnWriteMap } with an underlying { @ link java . util . LinkedHashMap } . Iterators for this map will be return
 * elements in insertion order . < / p >
 * < p > This map has { @ link View . Type # STABLE stable } views . < / p > */
public static < K , V > CopyOnWriteMap < K , V > newLinkedMap ( ) { } }

implementation: Builder < K , V > builder = builder ( ) ; return builder . newLinkedMap ( ) ;


signature:
public class AbstractBsonReader { /** * Throws an InvalidOperationException when the method called is not valid for the current ContextType .
 * @ param methodName The name of the method .
 * @ param actualContextType The actual ContextType .
 * @ param validContextTypes The valid ContextTypes .
 * @ throws BsonInvalidOperationException when the method called is not valid for the current ContextType . */
protected void throwInvalidContextType ( final String methodName , final BsonContextType actualContextType , final BsonContextType ... validContextTypes ) { } }

implementation: String validContextTypesString = StringUtils . join ( " or " , asList ( validContextTypes ) ) ; String message = format ( "%s can only be called when ContextType is %s, not when ContextType is %s." , methodName , validContextTypesString , actualContextType ) ; throw new BsonInvalidOperationException ( message ) ;


signature:
public class AbstractBsonReader { /** * Throws an InvalidOperationException when the method called is not valid for the current state .
 * @ param methodName The name of the method .
 * @ param validStates The valid states .
 * @ throws BsonInvalidOperationException when the method called is not valid for the current state . */
protected void throwInvalidState ( final String methodName , final State ... validStates ) { } }

implementation: String validStatesString = StringUtils . join ( " or " , asList ( validStates ) ) ; String message = format ( "%s can only be called when State is %s, not when State is %s." , methodName , validStatesString , state ) ; throw new BsonInvalidOperationException ( message ) ;


signature:
public class AbstractBsonReader { /** * Verifies the current state and BSONType of the reader .
 * @ param methodName The name of the method calling this one .
 * @ param requiredBsonType The required BSON type . */
protected void verifyBSONType ( final String methodName , final BsonType requiredBsonType ) { } }

implementation:
if ( state == State . INITIAL || state == State . SCOPE_DOCUMENT || state == State . TYPE ) { readBsonType ( ) ; } if ( state == State . NAME ) { // ignore name
skipName ( ) ; } if ( state != State . VALUE ) { throwInvalidState ( methodName , State . VALUE ) ; } if ( currentBsonType != requiredBsonType ) { throw new BsonInvalidOperationException ( format ( "%s can only be called when CurrentBSONType is %s, " + "not when CurrentBSONType is %s." , methodName , requiredBsonType , currentBsonType ) ) ; }


signature:
public class AbstractBsonReader { /** * Verifies the name of the current element .
 * @ param expectedName The expected name .
 * @ throws BsonSerializationException when the name read is not the expected name */
protected void verifyName ( final String expectedName ) { } }

implementation: readBsonType ( ) ; String actualName = readName ( ) ; if ( ! actualName . equals ( expectedName ) ) { throw new BsonSerializationException ( format ( "Expected element name to be '%s', not '%s'." , expectedName , actualName ) ) ; }


signature:
public class AbstractBsonReader { /** * Ensures any conditions are met before reading commences . Throws exceptions if the conditions are not met .
 * @ param methodName the name of the current method , which will indicate the field being read
 * @ param type the type of this field */
protected void checkPreconditions ( final String methodName , final BsonType type ) { } }

implementation: if ( isClosed ( ) ) { throw new IllegalStateException ( "BsonWriter is closed" ) ; } verifyBSONType ( methodName , type ) ;


signature:
public class AbstractBsonReader { /** * Returns the next { @ code State } to transition to , based on the { @ link org . bson . AbstractBsonReader . Context } of this reader .
 * @ return the next state */
protected State getNextState ( ) { } }

implementation: switch ( context . getContextType ( ) ) { case ARRAY : case DOCUMENT : case SCOPE_DOCUMENT : return State . TYPE ; case TOP_LEVEL : return State . DONE ; default : throw new BSONException ( format ( "Unexpected ContextType %s." , context . getContextType ( ) ) ) ; }


signature:
public class Decimal128 { /** * Returns a Decimal128 value representing the given String .
 * @ param value the Decimal128 value represented as a String
 * @ return the Decimal128 value representing the given String
 * @ throws NumberFormatException if the value is out of the Decimal128 range
 * @ see
 * < a href = " https : / / github . com / mongodb / specifications / blob / master / source / bson - decimal128 / decimal128 . rst # from - string - representation " >
 * From - String Specification < / a > */
public static Decimal128 parse ( final String value ) { } }

implementation: String lowerCasedValue = value . toLowerCase ( ) ; if ( NaN_STRINGS . contains ( lowerCasedValue ) ) { return NaN ; } if ( NEGATIVE_NaN_STRINGS . contains ( lowerCasedValue ) ) { return NEGATIVE_NaN ; } if ( POSITIVE_INFINITY_STRINGS . contains ( lowerCasedValue ) ) { return POSITIVE_INFINITY ; } if ( NEGATIVE_INFINITY_STRINGS . contains ( lowerCasedValue ) ) { return NEGATIVE_INFINITY ; } return new Decimal128 ( new BigDecimal ( value ) , value . charAt ( 0 ) == '-' ) ;


signature:
public class Decimal128 { /** * Gets a BigDecimal that is equivalent to this Decimal128.
 * @ return a BigDecimal that is equivalent to this Decimal128
 * @ throws ArithmeticException if the Decimal128 value is NaN , Infinity , - Infinity , or - 0 , none of which can be represented as a
 * BigDecimal */
public BigDecimal bigDecimalValue ( ) { } }

implementation:
if ( isNaN ( ) ) { throw new ArithmeticException ( "NaN can not be converted to a BigDecimal" ) ; } if ( isInfinite ( ) ) { throw new ArithmeticException ( "Infinity can not be converted to a BigDecimal" ) ; } BigDecimal bigDecimal = bigDecimalValueNoNegativeZeroCheck ( ) ; // If the BigDecimal is 0 , but the Decimal128 is negative , that means we have - 0.
if ( isNegative ( ) && bigDecimal . signum ( ) == 0 ) { throw new ArithmeticException ( "Negative zero can not be converted to a BigDecimal" ) ; } return bigDecimal ;


signature:
public class Decimal128 { /** * May have leading zeros . Strip them before considering making this method public */
private byte [ ] getBytes ( ) { } }


signature:
public class Decimal128 { /** * Converts this { @ code Decimal128 } to a { @ code double } . This conversion is similar to the < i > narrowing primitive conversion < / i > from
 * { @ code double } to { @ code float } as defined in < cite > The Java & trade ; Language Specification < / cite > : if this { @ code Decimal128 } has
 * too great a magnitude to represent as a { @ code double } , it will be converted to { @ link Double # NEGATIVE _ INFINITY } or
 * { @ link Double # POSITIVE _ INFINITY } as appropriate . Note that even when the return value is finite , this conversion can lose
 * information about the precision of the { @ code Decimal128 } value . Note that { @ code # NEGATIVE _ ZERO } is converted to { @ code 0.0d } .
 * @ return this { @ code Decimal128 } converted to a { @ code double } .
 * @ since 3.10 */
@ Override public double doubleValue ( ) { } }

implementation: if ( isNaN ( ) ) { return Double . NaN ; } if ( isInfinite ( ) ) { if ( isNegative ( ) ) { return Double . NEGATIVE_INFINITY ; } else { return Double . POSITIVE_INFINITY ; } } BigDecimal bigDecimal = bigDecimalValueNoNegativeZeroCheck ( ) ; if ( hasDifferentSign ( bigDecimal ) ) { return - 0.0d ; } return bigDecimal . doubleValue ( ) ;


signature:
public class AggregateExplainOperation { /** * Sets the maximum execution time on the server for this operation .
 * @ param maxTime the max time
 * @ param timeUnit the time unit , which may not be null
 * @ return this
 * @ mongodb . driver . manual reference / method / cursor . maxTimeMS / # cursor . maxTimeMS Max Time */
public AggregateExplainOperation maxTime ( final long maxTime , final TimeUnit timeUnit ) { } }

implementation: notNull ( "timeUnit" , timeUnit ) ; this . maxTimeMS = TimeUnit . MILLISECONDS . convert ( maxTime , timeUnit ) ; return this ;


signature:
public class AggregateExplainOperation { /** * Returns the hint for which index to use . The default is not to set a hint .
 * @ return the hint
 * @ since 3.6
 * @ mongodb . server . release 3.6 */
public BsonDocument getHint ( ) { } }

implementation: if ( hint == null ) { return null ; } if ( ! hint . isDocument ( ) ) { throw new IllegalArgumentException ( "Hint is not a BsonDocument please use the #getHintBsonValue() method. " ) ; } return hint . asDocument ( ) ;


signature:
public class AggregateExplainOperation { /** * Sets the hint for which index to use . A null value means no hint is set .
 * @ param hint the hint
 * @ return this
 * @ since 3.6
 * @ mongodb . server . release 3.6 */
public AggregateExplainOperation hint ( final BsonValue hint ) { } }

implementation: isTrueArgument ( "BsonString or BsonDocument" , hint == null || hint . isDocument ( ) || hint . isString ( ) ) ; this . hint = hint ; return this ;


signature:
public class Collation { /** * Gets this collation options as a document .
 * @ return The collation options as a BsonDocument */
public BsonDocument asDocument ( ) { } }

implementation: BsonDocument collation = new BsonDocument ( ) ; if ( locale != null ) { collation . put ( "locale" , new BsonString ( locale ) ) ; } if ( caseLevel != null ) { collation . put ( "caseLevel" , new BsonBoolean ( caseLevel ) ) ; } if ( caseFirst != null ) { collation . put ( "caseFirst" , new BsonString ( caseFirst . getValue ( ) ) ) ; } if ( strength != null ) { collation . put ( "strength" , new BsonInt32 ( strength . getIntRepresentation ( ) ) ) ; } if ( numericOrdering != null ) { collation . put ( "numericOrdering" , new BsonBoolean ( numericOrdering ) ) ; } if ( alternate != null ) { collation . put ( "alternate" , new BsonString ( alternate . getValue ( ) ) ) ; } if ( maxVariable != null ) { collation . put ( "maxVariable" , new BsonString ( maxVariable . getValue ( ) ) ) ; } if ( normalization != null ) { collation . put ( "normalization" , new BsonBoolean ( normalization ) ) ; } if ( backwards != null ) { collation . put ( "backwards" , new BsonBoolean ( backwards ) ) ; } return collation ;


signature:
public class MongoClientURI { /** * Gets the options
 * @ return the MongoClientOptions based on this URI . */
public MongoClientOptions getOptions ( ) { } }

implementation: ReadPreference readPreference = proxied . getReadPreference ( ) ; if ( readPreference != null ) { builder . readPreference ( readPreference ) ; } ReadConcern readConcern = proxied . getReadConcern ( ) ; if ( readConcern != null ) { builder . readConcern ( readConcern ) ; } WriteConcern writeConcern = proxied . getWriteConcern ( ) ; if ( writeConcern != null ) { builder . writeConcern ( writeConcern ) ; } if ( proxied . getRetryWritesValue ( ) != null ) { builder . retryWrites ( proxied . getRetryWritesValue ( ) ) ; } if ( proxied . getRetryReads ( ) != null ) { builder . retryReads ( proxied . getRetryReads ( ) ) ; } Integer maxConnectionPoolSize = proxied . getMaxConnectionPoolSize ( ) ; if ( maxConnectionPoolSize != null ) { builder . connectionsPerHost ( maxConnectionPoolSize ) ; } Integer integer = proxied . getMinConnectionPoolSize ( ) ; if ( integer != null ) { builder . minConnectionsPerHost ( integer ) ; } Integer maxWaitTime = proxied . getMaxWaitTime ( ) ; if ( maxWaitTime != null ) { builder . maxWaitTime ( maxWaitTime ) ; } Integer threadsAllowedToBlockForConnectionMultiplier = proxied . getThreadsAllowedToBlockForConnectionMultiplier ( ) ; if ( threadsAllowedToBlockForConnectionMultiplier != null ) { builder . threadsAllowedToBlockForConnectionMultiplier ( threadsAllowedToBlockForConnectionMultiplier ) ; } Integer maxConnectionIdleTime = proxied . getMaxConnectionIdleTime ( ) ; if ( maxConnectionIdleTime != null ) { builder . maxConnectionIdleTime ( maxConnectionIdleTime ) ; } Integer maxConnectionLifeTime = proxied . getMaxConnectionLifeTime ( ) ; if ( maxConnectionLifeTime != null ) { builder . maxConnectionLifeTime ( maxConnectionLifeTime ) ; } Integer socketTimeout = proxied . getSocketTimeout ( ) ; if ( socketTimeout != null ) { builder . socketTimeout ( socketTimeout ) ; } Integer connectTimeout = proxied . getConnectTimeout ( ) ; if ( connectTimeout != null ) { builder . connectTimeout ( connectTimeout ) ; } String requiredReplicaSetName = proxied . getRequiredReplicaSetName ( ) ; if ( requiredReplicaSetName != null ) { builder . requiredReplicaSetName ( requiredReplicaSetName ) ; } Boolean sslEnabled = proxied . getSslEnabled ( ) ; if ( sslEnabled != null ) { builder . sslEnabled ( sslEnabled ) ; } Boolean sslInvalidHostnameAllowed = proxied . getSslInvalidHostnameAllowed ( ) ; if ( sslInvalidHostnameAllowed != null ) { builder . sslInvalidHostNameAllowed ( sslInvalidHostnameAllowed ) ; } Integer serverSelectionTimeout = proxied . getServerSelectionTimeout ( ) ; if ( serverSelectionTimeout != null ) { builder . serverSelectionTimeout ( serverSelectionTimeout ) ; } Integer localThreshold = proxied . getLocalThreshold ( ) ; if ( localThreshold != null ) { builder . localThreshold ( localThreshold ) ; } Integer heartbeatFrequency = proxied . getHeartbeatFrequency ( ) ; if ( heartbeatFrequency != null ) { builder . heartbeatFrequency ( heartbeatFrequency ) ; } String applicationName = proxied . getApplicationName ( ) ; if ( applicationName != null ) { builder . applicationName ( applicationName ) ; } if ( ! proxied . getCompressorList ( ) . isEmpty ( ) ) { builder . compressorList ( proxied . getCompressorList ( ) ) ; } return builder . build ( ) ;


signature:
public class GridFSDBFile { /** * Writes the file ' s data to a file on disk .
 * @ param file the File object
 * @ return number of bytes written
 * @ throws IOException if there are problems writing to the { @ code file } */
public long writeTo ( final File file ) throws IOException { } }

implementation: FileOutputStream out = null ; try { out = new FileOutputStream ( file ) ; return writeTo ( out ) ; } finally { if ( out != null ) { out . close ( ) ; } }


signature:
public class GridFSDBFile { /** * Writes the file ' s data to an OutputStream .
 * @ param out the OutputStream
 * @ return number of bytes written
 * @ throws IOException if there are problems writing to { @ code out } */
public long writeTo ( final OutputStream out ) throws IOException { } }

implementation: int nc = numChunks ( ) ; for ( int i = 0 ; i < nc ; i ++ ) { out . write ( getChunk ( i ) ) ; } return length ;


signature:
public class GridFSDBFile { /** * Removes file from GridFS i . e . removes documents from files and chunks collections . */
void remove ( ) { } }

implementation: fs . getFilesCollection ( ) . remove ( new BasicDBObject ( "_id" , id ) ) ; fs . getChunksCollection ( ) . remove ( new BasicDBObject ( "files_id" , id ) ) ;


signature:
public class PushOptions { /** * Sets the sort direction for sorting array elements that are not documents .
 * @ param sort the sort direction
 * @ return this
 * @ throws IllegalStateException if sortDocument property is already set
 * @ mongodb . driver . manual reference / operator / update / sort / $ sort
 * @ mongodb . driver . manual reference / operator / update / sort / # sort - array - elements - that - are - not - documents */
public PushOptions sort ( @ Nullable final Integer sort ) { } }

implementation: if ( sortDocument != null ) { throw new IllegalStateException ( "sort can not be set if sortDocument already is" ) ; } this . sort = sort ; return this ;


signature:
public class PushOptions { /** * Sets the sort direction for sorting array elements that are documents .
 * @ param sortDocument the sort document
 * @ return this
 * @ throws IllegalStateException if sort property is already set
 * @ mongodb . driver . manual reference / operator / update / sort / $ sort */
public PushOptions sortDocument ( @ Nullable final Bson sortDocument ) { } }

implementation: if ( sort != null ) { throw new IllegalStateException ( "sortDocument can not be set if sort already is" ) ; } this . sortDocument = sortDocument ; return this ;


signature:
public class ChangeStreamDocument { /** * Returns the namespace
 * The invalidate operation type does include a MongoNamespace in the ChangeStreamDocument response . The
 * dropDatabase operation type includes a MongoNamespace , but does not include a collection name as part
 * of the namespace .
 * @ return the namespace . If the namespaceDocument is null or if it is missing either the ' db ' or ' coll ' keys ,
 * then this will return null . */
@ BsonIgnore @ Nullable public MongoNamespace getNamespace ( ) { } }

implementation: if ( namespaceDocument == null ) { return null ; } if ( ! namespaceDocument . containsKey ( "db" ) || ! namespaceDocument . containsKey ( "coll" ) ) { return null ; } return new MongoNamespace ( namespaceDocument . getString ( "db" ) . getValue ( ) , namespaceDocument . getString ( "coll" ) . getValue ( ) ) ;


signature:
public class ChangeStreamDocument { /** * Returns the database name
 * @ return the databaseName . If the namespaceDocument is null or if it is missing the ' db ' key , then this will
 * return null .
 * @ since 3.8 */
@ BsonIgnore @ Nullable public String getDatabaseName ( ) { } }

implementation: if ( namespaceDocument == null ) { return null ; } if ( ! namespaceDocument . containsKey ( "db" ) ) { return null ; } return namespaceDocument . getString ( "db" ) . getValue ( ) ;


signature:
public class ChangeStreamDocument { /** * Creates the codec for the specific ChangeStreamOutput type
 * @ param fullDocumentClass the class to use to represent the fullDocument
 * @ param codecRegistry the codec registry
 * @ param < TFullDocument > the fullDocument type
 * @ return the codec */
public static < TFullDocument > Codec < ChangeStreamDocument < TFullDocument > > createCodec ( final Class < TFullDocument > fullDocumentClass , final CodecRegistry codecRegistry ) { } }

implementation: return new ChangeStreamDocumentCodec < TFullDocument > ( fullDocumentClass , codecRegistry ) ;


signature:
public class QuickTour { /** * Run this main method to see the output of this quick example .
 * @ param args takes an optional single argument for the connection string */
public static void main ( final String [ ] args ) { } }

implementation:
MongoClient mongoClient ; if ( args . length == 0 ) { // connect to the local database server
mongoClient = MongoClients . create ( ) ; } else { mongoClient = MongoClients . create ( args [ 0 ] ) ; } // get handle to " mydb " database
MongoDatabase database = mongoClient . getDatabase ( "mydb" ) ; // get a handle to the " test " collection
MongoCollection < Document > collection = database . getCollection ( "test" ) ; // drop all the data in it
collection . drop ( ) ; // make a document and insert it
Document doc = new Document ( "name" , "MongoDB" ) . append ( "type" , "database" ) . append ( "count" , 1 ) . append ( "info" , new Document ( "x" , 203 ) . append ( "y" , 102 ) ) ; collection . insertOne ( doc ) ; // get it ( since it ' s the only one in there since we dropped the rest earlier on )
Document myDoc = collection . find ( ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // now , lets add lots of little documents to the collection so we can explore queries and cursors
List < Document > documents = new ArrayList < Document > ( ) ; for ( int i = 0 ; i < 100 ; i ++ ) { documents . add ( new Document ( "i" , i ) ) ; } collection . insertMany ( documents ) ; System . out . println ( "total # of documents after inserting 100 small ones (should be 101) " + collection . countDocuments ( ) ) ; // find first
myDoc = collection . find ( ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // lets get all the documents in the collection and print them out
MongoCursor < Document > cursor = collection . find ( ) . iterator ( ) ; try { while ( cursor . hasNext ( ) ) { System . out . println ( cursor . next ( ) . toJson ( ) ) ; } } finally { cursor . close ( ) ; } for ( Document cur : collection . find ( ) ) { System . out . println ( cur . toJson ( ) ) ; } // now use a query to get 1 document out
myDoc = collection . find ( eq ( "i" , 71 ) ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // now use a range query to get a larger subset
cursor = collection . find ( gt ( "i" , 50 ) ) . iterator ( ) ; try { while ( cursor . hasNext ( ) ) { System . out . println ( cursor . next ( ) . toJson ( ) ) ; } } finally { cursor . close ( ) ; } // range query with multiple constraints
cursor = collection . find ( and ( gt ( "i" , 50 ) , lte ( "i" , 100 ) ) ) . iterator ( ) ; try { while ( cursor . hasNext ( ) ) { System . out . println ( cursor . next ( ) . toJson ( ) ) ; } } finally { cursor . close ( ) ; } // Query Filters
myDoc = collection . find ( eq ( "i" , 71 ) ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // now use a range query to get a larger subset
Block < Document > printBlock = new Block < Document > ( ) { @ Override public void apply ( final Document document ) { System . out . println ( document . toJson ( ) ) ; } } ; collection . find ( gt ( "i" , 50 ) ) . forEach ( printBlock ) ; // filter where ; 50 < i < = 100
collection . find ( and ( gt ( "i" , 50 ) , lte ( "i" , 100 ) ) ) . forEach ( printBlock ) ; // Sorting
myDoc = collection . find ( exists ( "i" ) ) . sort ( descending ( "i" ) ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // Projection
myDoc = collection . find ( ) . projection ( excludeId ( ) ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // Aggregation
collection . aggregate ( asList ( match ( gt ( "i" , 0 ) ) , project ( Document . parse ( "{ITimes10: {$multiply: ['$i', 10]}}" ) ) ) ) . forEach ( printBlock ) ; myDoc = collection . aggregate ( singletonList ( group ( null , sum ( "total" , "$i" ) ) ) ) . first ( ) ; System . out . println ( myDoc . toJson ( ) ) ; // Update One
collection . updateOne ( eq ( "i" , 10 ) , set ( "i" , 110 ) ) ; // Update Many
UpdateResult updateResult = collection . updateMany ( lt ( "i" , 100 ) , inc ( "i" , 100 ) ) ; System . out . println ( updateResult . getModifiedCount ( ) ) ; // Delete One
collection . deleteOne ( eq ( "i" , 110 ) ) ; // Delete Many
DeleteResult deleteResult = collection . deleteMany ( gte ( "i" , 100 ) ) ; System . out . println ( deleteResult . getDeletedCount ( ) ) ; collection . drop ( ) ; // ordered bulk writes
List < WriteModel < Document > > writes = new ArrayList < WriteModel < Document > > ( ) ; writes . add ( new InsertOneModel < Document > ( new Document ( "_id" , 4 ) ) ) ; writes . add ( new InsertOneModel < Document > ( new Document ( "_id" , 5 ) ) ) ; writes . add ( new InsertOneModel < Document > ( new Document ( "_id" , 6 ) ) ) ; writes . add ( new UpdateOneModel < Document > ( new Document ( "_id" , 1 ) , new Document ( "$set" , new Document ( "x" , 2 ) ) ) ) ; writes . add ( new DeleteOneModel < Document > ( new Document ( "_id" , 2 ) ) ) ; writes . add ( new ReplaceOneModel < Document > ( new Document ( "_id" , 3 ) , new Document ( "_id" , 3 ) . append ( "x" , 4 ) ) ) ; collection . bulkWrite ( writes ) ; collection . drop ( ) ; collection . bulkWrite ( writes , new BulkWriteOptions ( ) . ordered ( false ) ) ; // collection . find ( ) . forEach ( printBlock ) ;
// Clean up
database . drop ( ) ; // release resources
mongoClient . close ( ) ;


signature:
public class EstimatedDocumentCountOptions { /** * Sets the maximum execution time on the server for this operation .
 * @ param maxTime the max time
 * @ param timeUnit the time unit , which may not be null
 * @ return this */
public EstimatedDocumentCountOptions maxTime ( final long maxTime , final TimeUnit timeUnit ) { } }


signature:
public class LocalTimeCodec { /** * { @ inheritDoc }
 * < p > Converts the { @ code LocalTime } to { @ link ZoneOffset # UTC } at EpochDay via { @ link LocalTime # atDate ( LocalDate ) } and
 * { @ link java . time . LocalDateTime # toInstant ( ZoneOffset ) } . < / p > */
@ Override public void encode ( final BsonWriter writer , final LocalTime value , final EncoderContext encoderContext ) { } }

implementation: writer . writeDateTime ( value . atDate ( LocalDate . ofEpochDay ( 0L ) ) . toInstant ( ZoneOffset . UTC ) . toEpochMilli ( ) ) ;


signature:
public class ClientSessionOptions { /** * Gets an instance of a builder initialized with the given options
 * @ param options the options with which to initialize the builder
 * @ return a builder instance
 * @ since 3.8 */
public static Builder builder ( final ClientSessionOptions options ) { } }

implementation: notNull ( "options" , options ) ; Builder builder = new Builder ( ) ; builder . causallyConsistent = options . isCausallyConsistent ( ) ; builder . defaultTransactionOptions = options . getDefaultTransactionOptions ( ) ; return builder ;


signature:
public class MongoOptions { /** * Reset all settings to the default . */
public void reset ( ) { } }

implementation: connectionsPerHost = 10 ; threadsAllowedToBlockForConnectionMultiplier = 5 ; maxWaitTime = 1000 * 60 * 2 ; connectTimeout = 1000 * 10 ; socketFactory = SocketFactory . getDefault ( ) ; socketTimeout = 0 ; socketKeepAlive = false ; readPreference = null ; writeConcern = null ; safe = false ; w = 0 ; wtimeout = 0 ; fsync = false ; j = false ; dbDecoderFactory = DefaultDBDecoder . FACTORY ; dbEncoderFactory = DefaultDBEncoder . FACTORY ; description = null ; cursorFinalizerEnabled = true ; alwaysUseMBeans = false ; requiredReplicaSetName = null ;


signature:
public class MongoOptions { /** * Copy this MongoOptions instance into a new instance .
 * @ return the new MongoOptions with the same settings as this instance . */
public MongoOptions copy ( ) { } }

implementation: MongoOptions m = new MongoOptions ( ) ; m . connectionsPerHost = connectionsPerHost ; m . threadsAllowedToBlockForConnectionMultiplier = threadsAllowedToBlockForConnectionMultiplier ; m . maxWaitTime = maxWaitTime ; m . connectTimeout = connectTimeout ; m . socketFactory = socketFactory ; m . socketTimeout = socketTimeout ; m . socketKeepAlive = socketKeepAlive ; m . readPreference = readPreference ; m . writeConcern = writeConcern ; m . safe = safe ; m . w = w ; m . wtimeout = wtimeout ; m . fsync = fsync ; m . j = j ; m . dbDecoderFactory = dbDecoderFactory ; m . dbEncoderFactory = dbEncoderFactory ; m . description = description ; m . cursorFinalizerEnabled = cursorFinalizerEnabled ; m . alwaysUseMBeans = alwaysUseMBeans ; m . requiredReplicaSetName = requiredReplicaSetName ; return m ;


signature:
public class MongoOptions { /** * Helper method to return the appropriate WriteConcern instance based on the current related options settings .
 * @ return a WriteConcern for the current MongoOptions . */
@ SuppressWarnings ( "deprecation" ) public WriteConcern getWriteConcern ( ) { } }

implementation: WriteConcern retVal ; if ( writeConcern != null ) { retVal = writeConcern ; } else if ( w != 0 || wtimeout != 0 || fsync | j ) { retVal = WriteConcern . ACKNOWLEDGED ; if ( w != 0 ) { retVal = retVal . withW ( w ) ; } if ( wtimeout != 0 ) { retVal = retVal . withWTimeout ( wtimeout , TimeUnit . MILLISECONDS ) ; } if ( fsync ) { retVal = retVal . withFsync ( fsync ) ; } if ( j ) { retVal = retVal . withJ ( j ) ; } } else if ( safe ) { retVal = WriteConcern . ACKNOWLEDGED ; } else { retVal = WriteConcern . UNACKNOWLEDGED ; } return retVal ;


signature:
public class TaggableReadPreference { /** * Gets the maximum acceptable staleness of a secondary in order to be considered for read operations .
 * The maximum staleness feature is designed to prevent badly - lagging servers from being selected . The staleness estimate is imprecise
 * and shouldn ' t be used to try to select " up - to - date " secondaries .
 * The driver estimates the staleness of each secondary , based on lastWriteDate values provided in server isMaster responses ,
 * and selects only those secondaries whose staleness is less than or equal to maxStaleness .
 * @ param timeUnit the time unit in which to return the value
 * @ return the maximum acceptable staleness in the given time unit , or null if the value is not set
 * @ mongodb . server . release 3.4
 * @ since 3.4 */
@ Nullable public Long getMaxStaleness ( final TimeUnit timeUnit ) { } }

implementation: notNull ( "timeUnit" , timeUnit ) ; if ( maxStalenessMS == null ) { return null ; } return timeUnit . convert ( maxStalenessMS , TimeUnit . MILLISECONDS ) ;


signature:
public class AzureMonitorMetricsExportAutoConfiguration { /** * This bean is already available when the
 * { @ see < a href = " https : / / github . com / Microsoft / ApplicationInsights - Java / tree / master /
 * azure - application - insights - spring - boot - starter " > Azure Application Insights starter < / a > }
 * is present . */
@ Bean @ ConditionalOnMissingBean public TelemetryConfiguration telemetryConfiguration ( AzureMonitorConfig config ) { } }

implementation:
// Gets the active instance of TelemetryConfiguration either created by starter or xml
final TelemetryConfiguration telemetryConfiguration = TelemetryConfiguration . getActive ( ) ; if ( StringUtils . isEmpty ( telemetryConfiguration . getInstrumentationKey ( ) ) ) { telemetryConfiguration . setInstrumentationKey ( config . instrumentationKey ( ) ) ; } return telemetryConfiguration ;


signature:
public class UserAgent { /** * Generate UserAgent string for given service .
 * @ param serviceName Name of the service from which called this method .
 * @ param allowTelemetry Whether allows telemtry
 * @ return generated UserAgent string */
public static String getUserAgent ( String serviceName , boolean allowTelemetry ) { } }

implementation: String macAddress = "Not Collected" ; if ( allowTelemetry ) { macAddress = GetHashMac . getHashMac ( ) ; } return String . format ( serviceName + " MacAddressHash:%s" , macAddress ) ;


signature:
public class AADB2CAuthorizationRequestResolver { /** * The B2C service will enhance that , and then related code will be removed . */
private boolean isForgotPasswordAuthorizationRequest ( @ NonNull HttpServletRequest request ) { } }

implementation: final String error = request . getParameter ( "error" ) ; final String description = request . getParameter ( "error_description" ) ; if ( "access_denied" . equals ( error ) ) { Assert . hasText ( description , "description should contain text." ) ; return description . startsWith ( "AADB2C90118:" ) ; } return false ;


signature:
public class VcapResult { /** * Populates default properties during @ EnvironmentPostProcessor processing .
 * Note that this class gets invoked before Spring creates the logging
 * subsystem , so we just use System . out . println instead . */
@ SuppressFBWarnings ( "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" ) private void populateProperties ( ConfigurableEnvironment environment , VcapPojo [ ] pojos ) { } }

implementation: final Map < String , Object > map = new HashMap < > ( ) ; populateDefaultStorageProperties ( map , findPojoForServiceType ( VcapServiceType . AZURE_STORAGE , pojos ) ) ; populateDefaultServiceBusProperties ( map , findPojoForServiceType ( VcapServiceType . AZURE_SERVICEBUS , pojos ) ) ; populateDefaultDocumentDBProperties ( map , findPojoForServiceType ( VcapServiceType . AZURE_DOCUMENTDB , pojos ) ) ; addOrReplace ( environment . getPropertySources ( ) , map ) ;


signature:
public class AzureADGraphClient { /** * Checks that the JSON Node is a valid User Group to extract User Groups from
 * @ param node - json node to look for a key / value to equate against the { @ link UserGroupProperties }
 * @ return true if the json node contains the correct key , and expected value to identify a user group . */
private boolean isMatchingUserGroupKey ( final JsonNode node ) { } }

implementation: return node . get ( aadAuthenticationProperties . getUserGroup ( ) . getKey ( ) ) . asText ( ) . equals ( aadAuthenticationProperties . getUserGroup ( ) . getValue ( ) ) ;


signature:
public class AzureADGraphClient { /** * Converts UserGroup list to Set of GrantedAutorities
 * @ param groups
 * @ return */
public Set < GrantedAuthority > convertGroupsToGrantedAuthorities ( final List < UserGroup > groups ) { } }

implementation:
// Map the authority information to one or more GrantedAuthority ' s and add it to mappedAuthorities
final Set < GrantedAuthority > mappedAuthorities = groups . stream ( ) . filter ( this :: isValidUserGroupToGrantAuthority ) . map ( userGroup -> new SimpleGrantedAuthority ( DEFAULT_ROLE_PREFIX + userGroup . getDisplayName ( ) ) ) . collect ( Collectors . toCollection ( LinkedHashSet :: new ) ) ; if ( mappedAuthorities . isEmpty ( ) ) { mappedAuthorities . add ( DEFAULT_AUTHORITY ) ; } return mappedAuthorities ;


signature:
public class AzureADGraphClient { /** * Determines if this is a valid { @ link UserGroup } to build to a GrantedAuthority .
 * If the { @ link UserGroupProperties # getAllowedGroups ( ) } or the { @ link
 * AADAuthenticationProperties # getActiveDirectoryGroups ( ) } contains the { @ link UserGroup # getDisplayName ( ) } return
 * true .
 * @ param group - User Group to check if valid to grant an authority to .
 * @ return true if either of the allowed - groups or active - directory - groups contains the UserGroup display name */
private boolean isValidUserGroupToGrantAuthority ( final UserGroup group ) { } }

implementation: return aadAuthenticationProperties . getUserGroup ( ) . getAllowedGroups ( ) . contains ( group . getDisplayName ( ) ) || aadAuthenticationProperties . getActiveDirectoryGroups ( ) . contains ( group . getDisplayName ( ) ) ;


signature:
public class KeyVaultOperation { /** * For convention we need to support all relaxed binding format from spring , these may include :
 * < table >
 * < tr > < td > Spring relaxed binding names < / td > < / tr >
 * < tr > < td > acme . my - project . person . first - name < / td > < / tr >
 * < tr > < td > acme . myProject . person . firstName < / td > < / tr >
 * < tr > < td > acme . my _ project . person . first _ name < / td > < / tr >
 * < tr > < td > ACME _ MYPROJECT _ PERSON _ FIRSTNAME < / td > < / tr >
 * < / table >
 * But azure keyvault only allows ^ [ 0-9a - zA - Z - ] + $ and case insensitive , so there must be some conversion
 * between spring names and azure keyvault names .
 * For example , the 4 properties stated above should be convert to acme - myproject - person - firstname in keyvault .
 * @ param property of secret instance .
 * @ return the value of secret with given name or null . */
public String get ( final String property ) { } }

implementation:
Assert . hasText ( property , "property should contain text." ) ; final String secretName = getKeyvaultSecretName ( property ) ; // refresh periodically
if ( System . currentTimeMillis ( ) - this . lastUpdateTime . get ( ) > this . cacheRefreshIntervalInMs ) { synchronized ( this . refreshLock ) { if ( System . currentTimeMillis ( ) - this . lastUpdateTime . get ( ) > this . cacheRefreshIntervalInMs ) { this . lastUpdateTime . set ( System . currentTimeMillis ( ) ) ; fillSecretsHashMap ( ) ; } } } if ( this . propertyNamesHashMap . containsKey ( secretName ) ) { final SecretBundle secretBundle = this . keyVaultClient . getSecret ( this . vaultUri , secretName ) ; return secretBundle . value ( ) ; } else { return null ; }


signature:
public class ServiceEndpointsProperties { /** * Get ServiceEndpoints data for the given environment .
 * @ param environment the environment of the cloud service
 * @ return The ServiceEndpoints data for the given azure service < code > environment < / code > */
public ServiceEndpoints getServiceEndpoints ( String environment ) { } }

implementation: Assert . notEmpty ( endpoints , "No service endpoints found" ) ; if ( ! endpoints . containsKey ( environment ) ) { throw new IllegalArgumentException ( environment + " is not found in the configuration," + " only following environments are supported: " + endpoints . keySet ( ) ) ; } return endpoints . get ( environment ) ;


signature:
public class ServiceBusRestController { /** * https : / / azure . microsoft . com / en - us / services / service - bus / */
private void sendQueueMessage ( ) throws ServiceBusException , InterruptedException { } }

implementation: final String messageBody = "queue message" ; LOG . debug ( "Sending message: " + messageBody ) ; final Message message = new Message ( messageBody . getBytes ( StandardCharsets . UTF_8 ) ) ; queueClientForSending . send ( message ) ;


signature:
public class AADAuthenticationFilterAutoConfiguration { /** * Declare AADAuthenticationFilter bean .
 * @ return AADAuthenticationFilter bean */
@ Bean @ Scope ( BeanDefinition . SCOPE_SINGLETON ) @ ConditionalOnMissingBean ( AADAuthenticationFilter . class ) public AADAuthenticationFilter azureADJwtTokenFilter ( ) { } }

implementation: LOG . info ( "AzureADJwtTokenFilter Constructor." ) ; return new AADAuthenticationFilter ( aadAuthProps , serviceEndpointsProps , getJWTResourceRetriever ( ) ) ;


signature:
public class TodolistController { /** * HTTP GET */
@ RequestMapping ( value = "/api/todolist/{index}" , method = RequestMethod . GET , produces = { } }

implementation: MediaType . APPLICATION_JSON_VALUE } ) public ResponseEntity < ? > getTodoItem ( @ PathVariable ( "index" ) int index ) { if ( index > todoList . size ( ) - 1 ) { return new ResponseEntity < > ( new TodoItem ( - 1 , "index out of range" , null ) , HttpStatus . NOT_FOUND ) ; } return new ResponseEntity < > ( todoList . get ( index ) , HttpStatus . OK ) ;


signature:
public class TodolistController { /** * HTTP GET ALL */
@ RequestMapping ( value = "/api/todolist" , method = RequestMethod . GET , produces = { } }

implementation: MediaType . APPLICATION_JSON_VALUE } ) public ResponseEntity < List < TodoItem > > getAllTodoItems ( ) { return new ResponseEntity < > ( todoList , HttpStatus . OK ) ;


signature:
public class TodolistController { /** * HTTP PUT */
@ PreAuthorize ( "hasRole('ROLE_group1')" ) @ RequestMapping ( value = "/api/todolist" , method = RequestMethod . PUT , consumes = MediaType . APPLICATION_JSON_VALUE ) public ResponseEntity < String > updateTodoItem ( @ RequestBody TodoItem item ) { } }

implementation: final List < TodoItem > find = todoList . stream ( ) . filter ( i -> i . getID ( ) == item . getID ( ) ) . collect ( Collectors . toList ( ) ) ; if ( ! find . isEmpty ( ) ) { todoList . set ( todoList . indexOf ( find . get ( 0 ) ) , item ) ; return new ResponseEntity < > ( "Entity is updated" , HttpStatus . OK ) ; } return new ResponseEntity < > ( "Entity not found" , HttpStatus . OK ) ;


signature:
public class TodolistController { /** * HTTP DELETE */
@ RequestMapping ( value = "/api/todolist/{id}" , method = RequestMethod . DELETE ) public ResponseEntity < String > deleteTodoItem ( @ PathVariable ( "id" ) int id , PreAuthenticatedAuthenticationToken authToken ) { } }

implementation: final UserPrincipal current = ( UserPrincipal ) authToken . getPrincipal ( ) ; if ( current . isMemberOf ( new UserGroup ( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" , "group1" ) ) ) { final List < TodoItem > find = todoList . stream ( ) . filter ( i -> i . getID ( ) == id ) . collect ( Collectors . toList ( ) ) ; if ( ! find . isEmpty ( ) ) { todoList . remove ( todoList . indexOf ( find . get ( 0 ) ) ) ; return new ResponseEntity < > ( "OK" , HttpStatus . OK ) ; } return new ResponseEntity < > ( "Entity not found" , HttpStatus . OK ) ; } else { return new ResponseEntity < > ( "Access is denied" , HttpStatus . OK ) ; }


signature:
public class MediaServicesSampleApplication { /** * https : / / docs . microsoft . com / en - us / azure / media - services / media - services - java - how - to - use */
@ Override public void run ( String ... args ) throws Exception { } }

implementation:
// Upload a local file to an Asset
final AssetInfo uploadAsset = uploadFileAndCreateAsset ( "video.mp4" ) ; System . out . println ( "Uploaded Asset Id: " + uploadAsset . getId ( ) ) ; System . out . println ( "Sample completed!" ) ;


signature:
public class ServiceBusSampleApplication { /** * For complete documentation of Service Bus , reference https : / / azure . microsoft . com / en - us / services / service - bus / */
private void sendQueueMessage ( ) throws ServiceBusException , InterruptedException { } }

implementation: final String messageBody = "queue message" ; System . out . println ( "Sending message: " + messageBody ) ; final Message message = new Message ( messageBody . getBytes ( StandardCharsets . UTF_8 ) ) ; queueClient . send ( message ) ;


signature:
public class Err { /** * Produces a friendly view of the err , resulting map has these attributes :
 * < pre >
 * message : exception message ( if present )
 * stacktrace : array with the stacktrace
 * status : status code
 * reason : a status code reason
 * < / pre >
 * @ param stacktrace True for adding stacktrace .
 * @ return A lightweight view of the err . */
public Map < String , Object > toMap ( boolean stacktrace ) { } }

implementation: Status status = Status . valueOf ( this . status ) ; Throwable cause = Optional . ofNullable ( getCause ( ) ) . orElse ( this ) ; String message = Optional . ofNullable ( cause . getMessage ( ) ) . orElse ( status . reason ( ) ) ; Map < String , Object > err = new LinkedHashMap < > ( ) ; err . put ( "message" , message ) ; if ( stacktrace ) { err . put ( "stacktrace" , Throwables . getStackTraceAsString ( cause ) . replace ( "\r" , "" ) . split ( "\\n" ) ) ; } err . put ( "status" , status . value ( ) ) ; err . put ( "reason" , status . reason ( ) ) ; return err ;


signature:
public class Err { /** * Build an error message using the HTTP status .
 * @ param status The HTTP Status .
 * @ param tail A message to append .
 * @ return An error message . */
private static String message ( final Status status , @ Nullable final String tail ) { } }

implementation: return message ( status . reason ( ) , status . value ( ) , tail ) ;


signature:
public class Err { /** * Build an error message using the HTTP status .
 * @ param reason Reason .
 * @ param status The Status .
 * @ param tail A message to append .
 * @ return An error message . */
private static String message ( final String reason , final int status , @ Nullable final String tail ) { } }

implementation: return reason + "(" + status + ")" + ( tail == null ? "" : ": " + tail ) ;


signature:
public class LiveReload { /** * Add the given path to the watcher .
 * @ param path Path to watch .
 * @ param includes Glob pattern of matching files .
 * @ return This module . */
public LiveReload register ( final Path path , final String ... includes ) { } }

implementation: if ( Files . exists ( path ) ) { paths . add ( new Object [ ] { path , Arrays . asList ( includes ) } ) ; } return this ;


signature:
public class AssetCompiler { /** * Get all the assets for the provided file set . Example :
 * < pre >
 * assets {
 * fileset {
 * home : [ home . css , home . js ]
 * < / pre >
 * This method returns < code > home . css < / code > and < code > home . js < / code > for < code > home < / code > file
 * set . If there is no fileset under that name then it returns an empty list .
 * @ param name Fileset name .
 * @ return List of files or empty list . */
public List < String > assets ( final String name ) { } }

implementation: return fileset . getOrDefault ( name , Collections . emptyList ( ) ) ;


signature:
public class AssetCompiler { /** * Get all the javascript ( or derived ) for the provided fileset . Example :
 * < pre >
 * assets {
 * fileset {
 * mypage : [ mypage . js , mypage . css ]
 * < / pre >
 * This method returns < code > mypage . js < / code > for < code > mypage < / code > fileset .
 * @ param fileset Fileset name .
 * @ return All the scripts for a fileset . */
public List < String > scripts ( final String fileset ) { } }

implementation: return assets ( fileset ) . stream ( ) . filter ( scripts ) . collect ( Collectors . toList ( ) ) ;


signature:
public class AssetCompiler { /** * List all the { @ link AssetProcessor } for a distribution ( a . k . a . environment ) .
 * @ param dist Distribution ' s name .
 * @ return A readonly list of available { @ link AssetProcessor } . */
public List < AssetProcessor > pipeline ( final String dist ) { } }

implementation: List < AssetProcessor > chain = this . pipeline . get ( dist ) ; if ( chain == null ) { log . debug ( "no pipeline for: {}" , dist ) ; return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( chain ) ;


signature:
public class AssetCompiler { /** * Build assets using the given distribution and write output to the provided directory .
 * Build process is defined as follow :
 * 1 . First , it runs all the aggregators ( if any )
 * 2 . Then iterates each fileset and per each file in the fileset it apply the processor pipeline .
 * 3 . Finally , it merge all the files into one file and compressed / optimized if need it .
 * @ param dist Distribution ' s name ( usually dev or dist ) .
 * @ param dir Output directory .
 * @ return Map with fileset name as key and list of generated assets .
 * @ throws Exception If something goes wrong . */
public Map < String , List < File > > build ( final String dist , final File dir ) throws Exception { } }

implementation: log . debug ( "{} aggregators: {}" , dist , aggregators ) ; aggregators ( aggregators , conf ) ; return buildInternal ( dist , dir ) ;


signature:
public class AssetCompiler { /** * Apply the processor pipeline to the given asset . Like { @ link # build ( String , File ) } but for a
 * single file or asset .
 * @ param filename Asset to build .
 * @ return Processed asset .
 * @ throws Exception If something goes wrong . */
public File buildOne ( String filename , File dir ) throws Exception { } }

implementation: String dist = "dev" ; final MediaType type ; AssetWriter writer ; if ( scripts . test ( filename ) ) { type = MediaType . js ; writer = new AssetWriter ( dist , null , dir , ".js" , ";" , charset , this . fileset , scripts ) ; } else if ( styles . test ( filename ) ) { type = MediaType . css ; writer = new AssetWriter ( dist , null , dir , ".css" , "" , charset , this . fileset , styles ) ; } else { return null ; } List < AssetProcessor > pipeline = pipeline ( dist ) ; compile ( pipeline , ImmutableList . of ( filename ) . iterator ( ) , type , writer , path -> true , 0 , 0 ) ; return new File ( dir , filename ) ;


signature:
public class AssetCompiler { /** * Print a summary of the given results .
 * @ param result Compilation result .
 * @ param outDir Output directory .
 * @ param dist Distribution ( dev or prod ) .
 * @ param duration Execution time in millis .
 * @ param extraInfo Additional information .
 * @ return Summary . */
public String summary ( Map < String , List < File > > result , Path outDir , String dist , long duration , String ... extraInfo ) { } }

implementation:
StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( "Summary:\n" ) ; long seconds = Duration . ofMillis ( duration ) . getSeconds ( ) ; String took = seconds > 0 ? seconds + "s" : duration + "ms" ; buffer . append ( "Pipeline: " ) . append ( pipeline ( dist ) ) . append ( "\n" ) ; buffer . append ( "Time: " ) . append ( took ) . append ( "\n" ) ; buffer . append ( "Output: " ) . append ( outDir ) . append ( "\n" ) ; Stream . of ( extraInfo ) . forEach ( line -> buffer . append ( line ) . append ( "\n" ) ) ; int w1 = result . keySet ( ) . stream ( ) . map ( it -> it . length ( ) + 2 ) . max ( Integer :: compareTo ) . orElse ( 0 ) ; int mw1 = Math . max ( w1 , "Fileset" . length ( ) + 2 ) ; int w2 = result . values ( ) . stream ( ) . flatMap ( List :: stream ) . map ( file -> outDir . relativize ( file . toPath ( ) ) . toString ( ) ) . map ( String :: length ) . max ( Integer :: compareTo ) . orElse ( 0 ) ; buffer . append ( format ( w1 , w2 , "Fileset" , "Output" , "Size" ) ) ; result . forEach ( ( fileset , files ) -> { if ( files . size ( ) > 0 ) { // Head
buffer . append ( format ( mw1 , w2 , "  " + fileset , "" , "" ) ) ; // Tail
files . forEach ( file -> buffer . append ( format ( mw1 , w2 , "" , outDir . relativize ( file . toPath ( ) ) , AssetCompiler . humanReadableByteCount ( file . length ( ) ) ) ) ) ; } } ) ; return buffer . toString ( ) ;


signature:
public class CaffeineCache { /** * Configure a cache builder and creates a new { @ link Cache } .
 * @ param configurer Configurer callback .
 * @ return This instance . */
public CaffeineCache < K , V > doWith ( final Callback < K , V , Cache < K , V > > configurer ) { } }

implementation: requireNonNull ( configurer , "Configurer callback is required." ) ; this . callback = configurer :: apply ; return this ;


signature:
public class CaffeineCache { /** * Configure a cache builder and creates a new { @ link AsyncLoadingCache } .
 * @ param configurer Configurer callback .
 * @ return This instance . */
public CaffeineCache < K , V > doWithAsync ( final AsyncCallback < K , V > configurer ) { } }


signature:
public class Watcher { /** * Register the given directory with the WatchService */
private void register ( final Path dir ) throws IOException { } }

implementation: WatchKey key = dir . register ( watcher , new Kind [ ] { ENTRY_CREATE , ENTRY_DELETE , ENTRY_MODIFY } , HIGH ) ; keys . put ( key , dir ) ;


signature:
public class GuavaCache { /** * Configure a cache builder and creates a new { @ link Cache } .
 * @ param configurer Configurer callback .
 * @ return This instance . */
public GuavaCache < K , V > doWith ( final Callback < K , V , Cache < K , V > > configurer ) { } }

implementation: this . callback = requireNonNull ( configurer , "Configurer callback is required." ) ; return this ;


signature:
public class RamlType { /** * Defines a new property .
 * @ param name Property name .
 * @ param type Property type .
 * @ param required True for required .
 * @ param values Enum values .
 * @ return This type . */
public RamlType newProperty ( String name , String type , boolean required , String ... values ) { } }

implementation: if ( properties == null ) { properties = new LinkedHashMap < > ( ) ; } if ( values . length > 0 ) { properties . put ( required ? name : name + "?" , ImmutableMap . of ( "enum" , values ) ) ; } else { properties . put ( required ? name : name + "?" , type ) ; } return this ;


signature:
public class RamlType { /** * Get a RAML type from string .
 * @ param name String name .
 * @ return RAML type . */
public static RamlType valueOf ( String name ) { } }

implementation: switch ( name . toLowerCase ( ) ) { case "boolean" : return BOOLEAN ; case "byte" : case "short" : case "int" : case "integer" : case "long" : return INTEGER ; case "float" : case "double" : return NUMBER ; case "char" : case "character" : case "string" : return STRING ; case "file" : case "upload" : case "path" : case "binary" : return FILE ; case "date" : case "datetime" : case "localdatetime" : return DATE_TIME ; } return new RamlType ( "object" , name ) ;


signature:
public class FileEventOptions { /** * Append a kind filter .
 * The default filter is : { @ link StandardWatchEventKinds # ENTRY _ CREATE } ,
 * { @ link StandardWatchEventKinds # ENTRY _ DELETE } and { @ link StandardWatchEventKinds # ENTRY _ MODIFY } .
 * @ param kind Filter type .
 * @ return This options . */
public FileEventOptions kind ( final WatchEvent . Kind < Path > kind ) { } }

implementation: requireNonNull ( kind , "WatchEvent.Kind required." ) ; kinds . add ( kind ) ; return this ;


signature:
public class FileEventOptions { /** * Add a path filter using < code > glob < / code > expression , like < code > * * & # 47 ; * . java < / code > ,
 * etc . . .
 * @ param expression Glob expression .
 * @ return This options . */
public FileEventOptions includes ( final String expression ) { } }

implementation: requireNonNull ( expression , "Glob expression required." ) ; this . matchers . add ( new GlobPathMatcher ( expression ) ) ; return this ;


signature:
public class Hbs { /** * Set a handlebars callback .
 * < pre > { @ code
 * use ( new Hbs ( ) . doWith ( ( hbs , conf ) - > {
 * } < / pre >
 * @ param callback Configurer callback .
 * @ return This module . */
public Hbs doWith ( final Consumer < Handlebars > callback ) { } }

implementation: requireNonNull ( callback , "Configurer is required." ) ; return doWith ( ( hbs , conf ) -> callback . accept ( hbs ) ) ;


signature:
public class Gzon { /** * Configurer callback .
 * < pre >
 * use ( new Gzon ( ) . doWith ( ( builder , config ) { @ literal - > } {
 * builder . setPrettyPrint ( ) ;
 * < / pre >
 * @ param configurer A callback .
 * @ return This instance . */
public Gzon doWith ( final Consumer < GsonBuilder > configurer ) { } }

implementation: requireNonNull ( configurer , "Configurer callback is required." ) ; this . configurer = ( gson , conf ) -> configurer . accept ( gson ) ; return this ;


signature:
public class Micrometer { /** * Advanced configuration of main registry .
 * @ param configurer Configurer callback .
 * @ return This module . */
public Micrometer doWith ( @ Nonnull final Consumer < CompositeMeterRegistry > configurer ) { } }

implementation: return doWith ( ( registry , conf ) -> configurer . accept ( registry ) ) ;


signature:
public class Thl { /** * Set a configuration callback .
 * < pre > { @ code
 * use ( new Thl ( ) . doWith ( engine - > {
 * } < / pre >
 * @ param callback Callback .
 * @ return This module . */
public Thl doWith ( final Consumer < TemplateEngine > callback ) { } }

implementation: requireNonNull ( callback , "Callback required." ) ; return doWith ( ( e , c ) -> callback . accept ( e ) ) ;


signature:
public class Auth { /** * Protect one or more urls with an { @ link Authorizer } . For example :
 * < pre >
 * use ( new Auth ( )
 * . form ( " * " )
 * . authorizer ( " admin " , " / admin / * * " , new RequireAnyRoleAuthorizer ( " admin " ) )
 * < / pre >
 * Previous example will protect any url with form authentication and require and admin role for
 * < code > / admin / < / code > or subpath of it .
 * NOTE : make sure url is protected by one pac4j client .
 * @ param name Authorizer name .
 * @ param pattern URL pattern to protected .
 * @ param authorizer Authorizer to apply .
 * @ return This module . */
public Auth authorizer ( final String name , final String pattern , final Authorizer < ? > authorizer ) { } }

implementation: authorizer ( authorizer , name , pattern ) ; return this ;


signature:
public class Auth { /** * Protect one or more urls with an { @ link Authorizer } . For example :
 * < pre >
 * use ( new Auth ( )
 * . form ( " * " )
 * . authorizer ( " admin " , " / admin / * * " , MyAuthorizer . class )
 * < / pre >
 * Previous example will protect any url with form authentication and require and admin role for
 * < code > / admin / < / code > or subpath of it .
 * NOTE : make sure url is protected by one pac4j client .
 * @ param name Authorizer name .
 * @ param pattern URL pattern to protected .
 * @ param authorizer Authorizer to apply .
 * @ return This module . */
@ SuppressWarnings ( "rawtypes" ) public Auth authorizer ( final String name , final String pattern , final Class < ? extends Authorizer > authorizer ) { } }


signature:
public class Auth { /** * Protect one or more urls with an { @ link Authorizer } . For example :
 * < pre >
 * use ( new Auth ( )
 * . form ( " * " )
 * . authorizer ( " admin " , " / admin / * * " , MyAuthorizer . class )
 * < / pre >
 * Previous example will protect any url with form authentication and require and admin role for
 * < code > / admin / < / code > or subpath of it .
 * @ param name Authorizer name .
 * @ param pattern URL pattern to protected .
 * @ param authorizer Authorizer to apply . */
private void authorizer ( final Object authorizer , final String name , final String pattern ) { } }

implementation: requireNonNull ( name , "An authorizer's name is required." ) ; requireNonNull ( pattern , "An authorizer's pattern is required." ) ; requireNonNull ( authorizer , "An authorizer is required." ) ; authorizers . put ( pattern , Maps . immutableEntry ( name , authorizer ) ) ;


signature:
public class Auth { /** * Add a form auth client .
 * @ param pattern URL pattern to protect .
 * @ param authenticator Authenticator to use .
 * @ return This module . */
public Auth form ( final String pattern , final Class < ? extends Authenticator < UsernamePasswordCredentials > > authenticator ) { } }

implementation: bindings . put ( pattern , ( binder , conf ) -> { TypeLiteral < Authenticator < UsernamePasswordCredentials > > usernamePasswordAuthenticator = new TypeLiteral < Authenticator < UsernamePasswordCredentials > > ( ) { } ; binder . bind ( usernamePasswordAuthenticator . getRawType ( ) ) . to ( authenticator ) ; bindProfile ( binder , CommonProfile . class ) ; Multibinder . newSetBinder ( binder , Client . class ) . addBinding ( ) . toProvider ( FormAuth . class ) ; return new FormFilter ( conf . getString ( "auth.form.loginUrl" ) , conf . getString ( "application.path" ) + authCallbackPath ( conf ) ) ; } ) ; return this ;


signature:
public class Auth { /** * Add a basic auth client .
 * @ param pattern URL pattern to protect .
 * @ param authenticator Authenticator to use .
 * @ return This module . */
public Auth basic ( final String pattern , final Class < ? extends Authenticator < UsernamePasswordCredentials > > authenticator ) { } }

implementation: bindings . put ( pattern , ( binder , config ) -> { TypeLiteral < Authenticator < UsernamePasswordCredentials > > usernamePasswordAuthenticator = new TypeLiteral < Authenticator < UsernamePasswordCredentials > > ( ) { } ; binder . bind ( usernamePasswordAuthenticator . getRawType ( ) ) . to ( authenticator ) ; bindProfile ( binder , CommonProfile . class ) ; Multibinder . newSetBinder ( binder , Client . class ) . addBinding ( ) . toProvider ( BasicAuth . class ) ; return new AuthFilter ( IndirectBasicAuthClient . class , CommonProfile . class ) ; } ) ; return this ;


signature:
public class Auth { /** * Add an auth client , like facebook , twitter , github , etc . . . Please note the require dependency
 * must be in the classpath .
 * @ param client Client to add .
 * @ param < C > Credentials .
 * @ param < U > CommonProfile .
 * @ return This module . */
public < C extends Credentials , U extends CommonProfile > Auth client ( final Client < C , U > client ) { } }

implementation: return client ( "*" , client ) ;


signature:
public class Auth { /** * Add an auth client , like facebook , twitter , github , etc . . . Please note the require dependency
 * must be in the classpath .
 * @ param pattern URL pattern to protect .
 * @ param client Client to add .
 * @ param < C > Credentials .
 * @ param < U > CommonProfile .
 * @ return This module . */
public < C extends Credentials , U extends CommonProfile > Auth client ( final String pattern , final Client < C , U > client ) { } }

implementation: return client ( pattern , config -> client ) ;


signature:
public class Auth { /** * Add an auth client , like facebook , twitter , github , etc . . . Please note the require dependency
 * must be in the classpath .
 * @ param provider Client to add .
 * @ param < C > Credentials .
 * @ param < U > CommonProfile .
 * @ return This module . */
public < C extends Credentials , U extends CommonProfile > Auth client ( final Function < Config , Client < C , U > > provider ) { } }

implementation: return client ( "*" , provider ) ;


signature:
public class Auth { /** * Add an auth client , like facebook , twitter , github , etc . . . Please note the require dependency
 * must be in the classpath .
 * @ param pattern URL pattern to protect .
 * @ param provider Client to add .
 * @ param < C > Credentials .
 * @ param < U > CommonProfile .
 * @ return This module . */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) public < C extends Credentials , U extends CommonProfile > Auth client ( final String pattern , final Function < Config , Client < C , U > > provider ) { bindings . put ( pattern , ( binder , config ) -> { Client < C , U > client = provider . apply ( config ) ; Multibinder . newSetBinder ( binder , Client . class ) . addBinding ( ) . toInstance ( client ) ; Class clientType = client . getClass ( ) ; Class profileType = ClientType . typeOf ( clientType ) ; bindProfile ( binder , profileType ) ; return new AuthFilter ( clientType , profileType ) ; } ) ; return this ;


signature:
public class Auth { /** * Add an auth client , like facebook , twitter , github , etc . . . Please note the require dependency
 * must be in the classpath .
 * @ param pattern URL pattern to protect .
 * @ param client Client to add .
 * @ param < C > Credentials .
 * @ param < U > CommonProfile .
 * @ return This module . */
@ SuppressWarnings ( { } }

implementation: "rawtypes" , "unchecked" } ) public < C extends Credentials , U extends CommonProfile > Auth client ( final String pattern , final Class < ? extends Client < C , U > > client ) { bindings . put ( pattern , ( binder , config ) -> { Multibinder . newSetBinder ( binder , Client . class ) . addBinding ( ) . to ( client ) ; Class profileType = ClientType . typeOf ( client ) ; bindProfile ( binder , profileType ) ; return new AuthFilter ( client , profileType ) ; } ) ; return this ;


signature:
public class Auth { /** * Setup the { @ link AuthStore } to use . Keep in mind the store is binded it as singleton .
 * @ param store Store to use .
 * @ return This module . */
public < U extends CommonProfile > Auth store ( final Class < ? extends AuthStore < U > > store ) { } }

implementation: this . storeClass = requireNonNull ( store , "Store is required." ) ; return this ;


signature:
public class Auth { /** * Set the logout and redirect URL patterns .
 * @ param logoutUrl Logout url , default is < code > / logout < / code > .
 * @ param redirecTo Redirect url , default is < code > / < / code > .
 * @ return This module . */
public Auth logout ( final String logoutUrl , final String redirecTo ) { } }

implementation: this . logoutUrl = Optional . of ( logoutUrl ) ; this . redirecTo = Optional . of ( redirecTo ) ; return this ;


signature:
public class Auth { /** * Set the logout and redirect URL patterns .
 * @ param logoutUrl Logout url , default is < code > / logout < / code > .
 * @ return This module . */
public Auth logout ( final String logoutUrl ) { } }

implementation: this . logoutUrl = Optional . of ( logoutUrl ) ; this . redirecTo = Optional . empty ( ) ; return this ;