public HostAndPort(String host, Integer port) { Contracts.assertNotNull( host, "host" ); Contracts.assertNotNull( host, "port" ); this.host = host; this.port = port; }
private AssociationContextImpl(AssociationTypeContext associationTypeContext, TuplePointer entityTuplePointer, OperationsQueue operationsQueue, TransactionContext transactionContext) { Contracts.assertParameterNotNull( associationTypeContext, "associationTypeContext" ); this.associationTypeContext = associationTypeContext; this.entityTuplePointer = entityTuplePointer; this.operationsQueue = operationsQueue; this.transactionContext = transactionContext; }
public Hosts(List<String> hosts, List<Integer> ports) { int length = hosts.size(); Contracts.assertTrue( length == ports.size(), "Not the same number of hosts and ports" ); this.hostsAndPorts = new ArrayList<HostAndPort>( length ); for ( int i = 0 ; i < length; i++ ) { hostsAndPorts.add( new HostAndPort( hosts.get( i ), ports.get( i ) ) ); } }
/** * Validates a String to be a valid name to be used in MongoDB for a collection name. * * @param collectionName */ private static void validateAsMongoDBCollectionName(String collectionName) { Contracts.assertStringParameterNotEmpty( collectionName, "requestedName" ); //Yes it has some strange requirements. if ( collectionName.startsWith( "system." ) ) { throw log.collectionNameHasInvalidSystemPrefix( collectionName ); } else if ( collectionName.contains( "\u0000" ) ) { throw log.collectionNameContainsNULCharacter( collectionName ); } else if ( collectionName.contains( "$" ) ) { throw log.collectionNameContainsDollarCharacter( collectionName ); } }
/** * Validates a String to be a valid name to be used in MongoDB for a collection name. * * @param collectionName */ private static void validateAsMongoDBCollectionName(String collectionName) { Contracts.assertStringParameterNotEmpty( collectionName, "requestedName" ); //Yes it has some strange requirements. if ( collectionName.startsWith( "system." ) ) { throw log.collectionNameHasInvalidSystemPrefix( collectionName ); } else if ( collectionName.contains( "\u0000" ) ) { throw log.collectionNameContainsNULCharacter( collectionName ); } else if ( collectionName.contains( "$" ) ) { throw log.collectionNameContainsDollarCharacter( collectionName ); } }
/** * Instantiates a new MultiPoint. * * @param points the list of points */ public GeoMultiPoint(List<GeoPoint> points) { super( TYPE ); Contracts.assertNotNull( points, "points" ); this.points = points; }
/** * Asserts that the given {@code String} is neither {@code null} nor an empty string. * * @param parameter the parameter to validate * @param parameterName the name of the parameter, will be used in the logging message in case the given object is * {@code null} or empty. * @throws IllegalArgumentException in case the given parameter is {@code null} or empty */ public static void assertStringParameterNotEmpty(String parameter, String parameterName) { assertParameterNotNull( parameter, parameterName ); if ( parameter.length() == 0 ) { throw log.parameterSringMustNotBeEmpty( parameterName ); } }
public HostAndPort getFirst() { Contracts.assertTrue( hasHost(), "getFirst called on an empty Hosts iterator" ); return hostsAndPorts.get( 0 ); }
/** * Instantiates a new LineString. * * @param startPoint the start point of the line * @param endPoint the end point of the line */ public GeoLineString(GeoPoint startPoint, GeoPoint endPoint) { super( TYPE ); Contracts.assertNotNull( startPoint, "startPoint" ); Contracts.assertNotNull( endPoint, "endPoint" ); this.startPoint = startPoint; this.endPoint = endPoint; }
@Override public MongoDBPropertyContext readConcern(ReadConcern readConcern) { Contracts.assertParameterNotNull( readConcern, "readConcern" ); addPropertyOption( new ReadConcernOption(), readConcern ); return this; }
/** * Instantiates a new MultiPoint. * * @param points the list of points */ public GeoMultiPoint(List<GeoPoint> points) { super( TYPE ); Contracts.assertNotNull( points, "points" ); this.points = points; }
@Override public MongoDBGlobalContext writeConcern(WriteConcern writeConcern) { Contracts.assertParameterNotNull( writeConcern, "writeConcern" ); addGlobalOption( new WriteConcernOption(), writeConcern ); return this; }
/** * Instantiates a new LineString. * * @param startPoint the start point of the line * @param endPoint the end point of the line */ public GeoLineString(GeoPoint startPoint, GeoPoint endPoint) { super( TYPE ); Contracts.assertNotNull( startPoint, "startPoint" ); Contracts.assertNotNull( endPoint, "endPoint" ); this.startPoint = startPoint; this.endPoint = endPoint; }
@Override public MongoDBGlobalContext readConcern(ReadConcern readConcern) { Contracts.assertParameterNotNull( readConcern, "readConcern" ); addGlobalOption( new ReadConcernOption(), readConcern ); return this; }
/** * Returns the association type context providing meta-data to be passed to grid dialects when working on this * association. * <p> * <b>Note:</b> Due to initialization order related constraints, this method may only be invoked after all * collection and entity persisters have been set up. Use {@link #getAssociationTypeContext(String)} when in need of * a context prior to that point. * * @return the association type context, it never returns {@code null} */ public AssociationTypeContext getAssociationTypeContext() { Contracts.assertNotNull( associationTypeContext, "Association type context has not yet been initialized" ); return associationTypeContext; }
@Override public MongoDBPropertyContext associationDocumentStorage(AssociationDocumentStorageType associationDocumentStorage) { Contracts.assertParameterNotNull( associationDocumentStorage, "associationDocumentStorage" ); addPropertyOption( new AssociationDocumentStorageOption(), associationDocumentStorage ); return this; }
/** * Instantiates a new Point. * * @param longitude the longitude of the point * @param latitude the latitude of the point */ public GeoPoint(double longitude, double latitude) { super( TYPE ); Contracts.assertNotNull( longitude, "longitude" ); Contracts.assertNotNull( latitude, "latitude" ); this.longitude = longitude; this.latitude = latitude; }
@Override public MongoDBEntityContext readConcern(ReadConcern readConcern) { Contracts.assertParameterNotNull( readConcern, "readConcern" ); addEntityOption( new ReadConcernOption(), readConcern ); return this; }
/** * Instantiates a new Point. * * @param longitude the longitude of the point * @param latitude the latitude of the point */ public GeoPoint(double longitude, double latitude) { super( TYPE ); Contracts.assertNotNull( longitude, "longitude" ); Contracts.assertNotNull( latitude, "latitude" ); this.longitude = longitude; this.latitude = latitude; }
@Override public MongoDBGlobalContext associationDocumentStorage(AssociationDocumentStorageType associationDocumentStorage) { Contracts.assertParameterNotNull( associationDocumentStorage, "associationDocumentStorage" ); addGlobalOption( new AssociationDocumentStorageOption(), associationDocumentStorage ); return this; } }