Elffuss BraidHub

kikocis/java-driver public

Merge pull request #504 from datastax/java971

JAVA-971: Make type codecs invariant.
Changesetb718a9ac5ff4f8e2ac0b82bd1776c98e69742d511c9a0c96fe68011ff9104b63
AuthorAlexandre Dutra <alexdut@gmail.com> · 2015-11-13 11:25 +01:00
CommitterAlexandre Dutra <alexdut@gmail.com> · 2015-11-13 11:25 +01:00
Parents92def205f1cf, 99cb8c3fcdfe

Browse the files at this changeset

17 files changed

modified changelog/README.md +2 −0
@@ -8,6 +8,7 @@
88 - [improvement] JAVA-885: Pass the authenticator name from the server to the auth provider.
99 - [improvement] JAVA-961: Raise an exception when an older version of guava (<16.01) is found.
1010 - [bug] JAVA-972: TypeCodec.parse() implementations should be case insensitive when checking for keyword NULL.
11+- [bug] JAVA-971: Make type codecs invariant.
1112
1213 Merged from 2.1 branch:
1314
@@ -25,6 +26,7 @@
2526 - [improvement] JAVA-652: Add DCAwareRoundRobinPolicy builder.
2627 - [improvement] JAVA-808: Add generic filtering policy that can be used to exclude specific DCs.
2728
29+
2830 ### 3.0.0-alpha4
2931
3032 - [improvement] JAVA-926: Change default consistency level to LOCAL_QUORUM.
modified driver-core/src/main/java/com/datastax/driver/core/TypeCodec.java +18 −5
@@ -508,6 +508,15 @@
508508 /**
509509 * Return {@code true} if this codec is capable of serializing
510510 * the given {@code javaType}.
511+ * <p>
512+ * The implementation is <em>invariant</em> with respect to the passed
513+ * argument (through the usage of {@link TypeToken#equals(Object)}
514+ * and <em>it's strongly recommended not to modify this behavior</em>.
515+ * This means that a codec will only ever accept the
516+ * <em>exact</em> Java type that it has been created for.
517+ * <p>
518+ * If the argument represents a Java primitive type, its wrapper type
519+ * is considered instead.
511520 *
512521 * @param javaType The Java type this codec should serialize from and deserialize to; cannot be {@code null}.
513522 * @return {@code true} if the codec is capable of serializing
@@ -519,7 +528,7 @@
519528 if (javaType.isPrimitive()) {
520529 javaType = primitiveToWrapperMap.get(javaType);
521530 }
522- return this.javaType.isAssignableFrom(javaType);
531+ return this.javaType.equals(javaType);
523532 }
524533
525534 /**
@@ -548,13 +557,17 @@
548557 * <p>
549558 * Implementation notes:
550559 * <ol>
560+ * <li>The default implementation is <em>covariant</em> with respect to the passed
561+ * argument (through the usage of {@link TypeToken#isAssignableFrom(TypeToken)}
562+ * and <em>it's strongly recommended not to modify this behavior</em>.
563+ * This means that, by default, a codec will accept
564+ * <em>any subtype</em> of the Java type that it has been created for.</li>
551565 * <li>The base implementation provided here can only handle non-parameterized types;
552566 * codecs handling parameterized types, such as collection types, must override
553567 * this method and perform some sort of "manual"
554568 * inspection of the actual type parameters.</li>
555- * <li>Similarly, codecs that only accept a partial subset of all possible values,
556- * such as {@link TimeUUIDCodec} or {@link AsciiCodec}, must override
557- * this method and manually inspect the object to check if it
569+ * <li>Similarly, codecs that only accept a partial subset of all possible values
570+ * must override this method and manually inspect the object to check if it
558571 * complies or not with the codec's limitations.</li>
559572 * </ol>
560573 *
@@ -565,7 +578,7 @@
565578 */
566579 public boolean accepts(Object value) {
567580 checkNotNull(value);
568- return accepts(TypeToken.of(value.getClass()));
581+ return this.javaType.isAssignableFrom(TypeToken.of(value.getClass()));
569582 }
570583
571584 @Override
modified driver-core/src/test/java/com/datastax/driver/core/TypeCodecTest.java +8 −4
@@ -184,8 +184,13 @@
184184 ACodec aCodec = new ACodec();
185185 codecRegistry.register(aCodec);
186186 assertThat(codecRegistry.codecFor(cint(), A.class)).isNotNull().isSameAs(aCodec);
187- // inheritance works: B is assignable to A
188- assertThat(codecRegistry.codecFor(cint(), B.class)).isNotNull().isSameAs(aCodec);
187+ try {
188+ // covariance not accepted: no codec handles B exactly
189+ codecRegistry.codecFor(cint(), B.class);
190+ fail();
191+ } catch (CodecNotFoundException e) {
192+ //ok
193+ }
189194 TypeCodec<List<A>> expected = TypeCodec.list(aCodec);
190195 TypeCodec<List<A>> actual = codecRegistry.codecFor(list(cint()), new TypeToken<List<A>>(){});
191196 assertThat(actual.getCqlType()).isEqualTo(expected.getCqlType());
@@ -214,8 +219,7 @@
214219 // ok
215220 }
216221 TypeCodec<List<B>> expectedB = TypeCodec.list(bCodec);
217- TypeCodec<List<B>> actualB = codecRegistry.codecFor(list(cint()), new TypeToken<List<B>>() {
218- });
222+ TypeCodec<List<B>> actualB = codecRegistry.codecFor(list(cint()), new TypeToken<List<B>>(){});
219223 assertThat(actualB.getCqlType()).isEqualTo(expectedB.getCqlType());
220224 assertThat(actualB.getJavaType()).isEqualTo(expectedB.getJavaType());
221225 }
modified features/README.md +2 −2
@@ -6,12 +6,12 @@
66 If you're reading this from the [generated HTML documentation on
77 github.io](http://datastax.github.io/java-driver/), use the "Read More"
88 menu on the right hand side. If you're [browsing the source files on
9-github.com](https://github.com/datastax/java-driver/tree/2.2/features),
9+github.com](https://github.com/datastax/java-driver/tree/3.0/features),
1010 simply navigate to each sub-directory.
1111
1212 This is a work in progress: new sections will be added to cover existing
1313 features or document new ones.
1414
1515 You can also find more help in the legacy
16-[user documentation](http://docs.datastax.com/en/developer/java-driver/2.2/java-driver/whatsNew2.html)
16+[user documentation](http://docs.datastax.com/en/developer/java-driver/2.1/java-driver/whatsNew2.html)
1717 on the DataStax website.
modified features/address_resolution/README.md +2 −2
@@ -31,7 +31,7 @@
3131 Note: the contact points provided while creating the `Cluster` are not translated, only
3232 addresses retrieved from or sent by Cassandra nodes are.
3333
34-[at]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/AddressTranslator.html
34+[at]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/AddressTranslator.html
3535
3636 ### EC2 multi-region
3737
@@ -56,4 +56,4 @@
5656 target instance. Then it performs a forward DNS lookup of the domain name; the EC2 DNS does the
5757 private/public switch automatically based on location.
5858
59-[ec2]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/EC2MultiRegionAddressTranslator.html
59+[ec2]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/EC2MultiRegionAddressTranslator.html
modified features/custom_codecs/README.md +42 −3
@@ -374,6 +374,45 @@
374374 Foo<Bar> foo = row.get(0, Foo.class);
375375 ```
376376
377+### Support for subtype polymorphism
378+
379+Suppose the following class hierarchy:
380+
381+```java
382+class Animal {}
383+class Cat extends Animal {}
384+```
385+
386+By default, a codec will accept to serialize any object that extends or
387+implements its declared Java type: a codec such as
388+`AnimalCodec extends TypeCodec<Animal>` will accept `Cat` instances as well.
389+
390+This allows a codec to handle interfaces and superclasses
391+in a generic way, regardless of the actual implementation being
392+used by client code; for example, the driver has a built-in codec
393+that handles `List` instances, and this codec is capable of
394+serializing any concrete `List` implementation.
395+
396+But this has one caveat: when setting or retrieving values
397+with `get()` and `set()`, *it is vital to pass the exact
398+Java type the codec handles*:
399+
400+```java
401+codecRegistry.register(new AnimalCodec());
402+BoundStatement bs = ...
403+bs.set(0, new Cat(), Animal.class); // works
404+bs.set(0, new Cat(), Cat.class); // throws CodecNotFoundException
405+```
406+
407+The same is valid when retrieving values:
408+
409+```java
410+codecRegistry.register(new AnimalCodec());
411+Row row = ...
412+Animal animal = row.get(0, Animal.class); // works
413+Cat cat = row.get(0, Cat.class); // throws CodecNotFoundException
414+```
415+
377416 ### Performance considerations
378417
379418 A codec lookup operation may be costly; to mitigate this, the `CodecRegistry`
@@ -390,8 +429,8 @@
390429 4. if the creation succeeds, the registry adds the created codec to the cache and returns it;
391430 5. otherwise, the registry throws [CodecNotFoundException].
392431
393-The cache can be used as long as _at least the CQL type is known_. The following situations
394-are exceptions where it is _not_ possible to cache lookup results:
432+The cache can be used as long as *at least the CQL type is known*. The following situations
433+are exceptions where it is *not* possible to cache lookup results:
395434
396435 * With [SimpleStatement] instances;
397436 * With [BuiltStatement] instances (created via the Query Builder).
@@ -422,7 +461,7 @@
422461 [CustomType]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/DataType.CustomType.html
423462 [TypeToken]: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/reflect/TypeToken.html
424463 [SimpleStatement]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SimpleStatement.html
425-[BuiltStatement]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/BuiltStatement.html
464+[BuiltStatement]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/querybuilder/BuiltStatement.html
426465 [setList]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SettableByIndexData.html#setList(int,%20java.util.List)
427466 [setSet]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SettableByIndexData.html#setSet(int,%20java.util.Set)
428467 [setMap]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SettableByIndexData.html#setMap(int,%20java.util.Map)
modified features/custom_payloads/README.md +2 −2
@@ -241,8 +241,8 @@
241241 [CASSANDRA-8553]: https://issues.apache.org/jira/browse/CASSANDRA-8553
242242 [v4spec]: https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec
243243 [qh]: https://issues.apache.org/jira/browse/CASSANDRA-6659
244-[nhae]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/exceptions/NoHostAvailableException.html
244+[nhae]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/exceptions/NoHostAvailableException.html
245245 [chm]: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html
246246 [immutablemap]: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/ImmutableMap.html
247-[ufe]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/exceptions/UnsupportedFeatureException.html
247+[ufe]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/exceptions/UnsupportedFeatureException.html
248248
modified features/logging/README.md +1 −1
@@ -303,4 +303,4 @@
303303 </log4j:configuration>
304304 ```
305305
306-[query_logger]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/QueryLogger.html
306+[query_logger]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/QueryLogger.html
modified features/metadata/README.md +17 −17
@@ -4,7 +4,7 @@
44 is connected to. It is available via
55 [Cluster#getMetadata()][getMetadata].
66
7-[getMetadata]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Cluster.html#getMetadata()
7+[getMetadata]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Cluster.html#getMetadata()
88
99 ### Schema metadata
1010
@@ -12,8 +12,8 @@
1212 to get keyspace-level metadata. From there you can access the keyspace's
1313 objects (tables, and UDTs and UDFs if relevant).
1414
15-[getKeyspace]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#getKeyspace(java.lang.String)
16-[getKeyspaces]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#getKeyspaces()
15+[getKeyspace]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#getKeyspace(java.lang.String)
16+[getKeyspaces]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#getKeyspaces()
1717
1818 #### Refreshes
1919
@@ -135,9 +135,9 @@
135135
136136 Check out the API docs for the features in this section:
137137
138-* [withMaxSchemaAgreementWaitSeconds(int)](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Cluster.Builder.html#withMaxSchemaAgreementWaitSeconds(int))
139-* [isSchemaInAgreement()](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ExecutionInfo.html#isSchemaInAgreement())
140-* [checkSchemaAgreement()](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#checkSchemaAgreement())
138+* [withMaxSchemaAgreementWaitSeconds(int)](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Cluster.Builder.html#withMaxSchemaAgreementWaitSeconds(int))
139+* [isSchemaInAgreement()](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ExecutionInfo.html#isSchemaInAgreement())
140+* [checkSchemaAgreement()](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#checkSchemaAgreement())
141141
142142
143143 ### Token metadata
@@ -181,14 +181,14 @@
181181 table (see
182182 [CASSANDRA-7688](https://issues.apache.org/jira/browse/CASSANDRA-7688)).
183183
184-[metadata]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html
185-[getTokenRanges]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#getTokenRanges()
186-[getTokenRanges2]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#getTokenRanges(java.lang.String,%20com.datastax.driver.core.Host)
187-[getReplicas]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#getReplicas(java.lang.String,%20com.datastax.driver.core.TokenRange)
188-[newToken]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#newToken(java.lang.String)
189-[newTokenRange]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metadata.html#newTokenRange(com.datastax.driver.core.Token,%20com.datastax.driver.core.Token)
190-[TokenRange]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/TokenRange.html
191-[getTokens]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Host.html#getTokens()
192-[setToken]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/BoundStatement.html#setToken(int,%20com.datastax.driver.core.Token)
193-[getToken]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Row.html#getToken(int)
194-[getPKToken]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Row.html#getPartitionKeyToken()
184+[metadata]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html
185+[getTokenRanges]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#getTokenRanges()
186+[getTokenRanges2]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#getTokenRanges(java.lang.String,%20com.datastax.driver.core.Host)
187+[getReplicas]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#getReplicas(java.lang.String,%20com.datastax.driver.core.TokenRange)
188+[newToken]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#newToken(java.lang.String)
189+[newTokenRange]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metadata.html#newTokenRange(com.datastax.driver.core.Token,%20com.datastax.driver.core.Token)
190+[TokenRange]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/TokenRange.html
191+[getTokens]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Host.html#getTokens()
192+[setToken]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/BoundStatement.html#setToken(int,%20com.datastax.driver.core.Token)
193+[getToken]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Row.html#getToken(int)
194+[getPKToken]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Row.html#getPartitionKeyToken()
modified features/native_protocol/README.md +5 −5
@@ -59,7 +59,7 @@
5959 [/127.0.0.1:9042] Host /127.0.0.1:9042 does not support protocol version V3 but V2))
6060 ```
6161
62-[gpv]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ProtocolOptions.html#getProtocolVersion()
62+[gpv]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ProtocolOptions.html#getProtocolVersion()
6363
6464 #### Protocol version with mixed clusters
6565
@@ -90,19 +90,19 @@
9090 #### v1 to v2
9191
9292 * bound variables in simple statements
93- ([Session#execute(String, Object...)](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Session.html#execute(java.lang.String,%20java.lang.Object...)))
94-* [batch statements](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/BatchStatement.html)
93+ ([Session#execute(String, Object...)](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#execute(java.lang.String,%20java.lang.Object...)))
94+* [batch statements](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/BatchStatement.html)
9595 * [query paging](../paging/)
9696
9797 #### v2 to v3
9898
9999 * the number of stream ids per connection goes from 128 to 32768 (see
100100 [Connection pooling](../pooling/))
101-* [serial consistency on batch statements](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/BatchStatement.html#setSerialConsistencyLevel(com.datastax.driver.core.ConsistencyLevel))
101+* [serial consistency on batch statements](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/BatchStatement.html#setSerialConsistencyLevel(com.datastax.driver.core.ConsistencyLevel))
102102 * [client-side timestamps](../query_timestamps/)
103103
104104 #### v3 to v4
105105
106-* [query warnings](http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ExecutionInfo.html#getWarnings())
106+* [query warnings](http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ExecutionInfo.html#getWarnings())
107107 * allowed unset values in bound statements
108108 * [Custom payloads](../custom_payloads/)
modified features/object_mapper/creating/README.md +13 −13
@@ -43,9 +43,9 @@
4343 ones annotated `@Transient`) must have corresponding setters and
4444 getters.
4545
46-[table]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Table.html
46+[table]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Table.html
4747 [case-sensitive]:http://docs.datastax.com/en/cql/3.3/cql/cql_reference/ucase-lcase_r.html
48-[consistency level]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ConsistencyLevel.html
48+[consistency level]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ConsistencyLevel.html
4949
5050 #### Column names
5151
@@ -54,7 +54,7 @@
5454 name, or [case-sensitive] names, use the [@Column][column] annotation on
5555 the field.
5656
57-[column]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Column.html
57+[column]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Column.html
5858
5959 #### Primary key fields
6060
@@ -78,8 +78,8 @@
7878 The order of the indices must match that of the columns in the table
7979 declaration.
8080
81-[pk]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/PartitionKey.html
82-[cc]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/ClusteringColumn.html
81+[pk]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/PartitionKey.html
82+[cc]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/ClusteringColumn.html
8383 [pks]:http://thelastpickle.com/blog/2013/01/11/primary-keys-in-cql.html
8484
8585 #### Enumerations
@@ -105,7 +105,7 @@
105105 private Gender gender;
106106 ```
107107
108-[enum]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Enumerated.html
108+[enum]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Enumerated.html
109109
110110 #### Computed fields
111111
@@ -140,13 +140,13 @@
140140 [JAVA-832](https://datastax-oss.atlassian.net/browse/JAVA-832)).
141141
142142 [User Defined Functions]:http://www.planetcassandra.org/blog/user-defined-functions-in-cassandra-3-0/
143-[computed]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Computed.html
143+[computed]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Computed.html
144144
145145 #### Transient fields
146146
147147 [@Transient][transient] can be used to prevent a field from being mapped.
148148
149-[transient]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Transient.html
149+[transient]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Transient.html
150150
151151 ### Mapping User Types
152152
@@ -207,8 +207,8 @@
207207 arbitrary level of nesting)
208208
209209 [User Defined Types]:http://docs.datastax.com/en/developer/java-driver/2.1/java-driver/reference/userDefinedTypes.html
210-[udt]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/UDT.html
211-[field]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Field.html
210+[udt]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/UDT.html
211+[field]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Field.html
212212
213213 ### Mapping collections
214214
@@ -244,6 +244,6 @@
244244 private Map<String, List<Address>> frozenValueMap;
245245 ```
246246
247-[frozen]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Frozen.html
248-[frozenkey]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/FrozenKey.html
249-[frozenvalue]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/FrozenValue.html
247+[frozen]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Frozen.html
248+[frozenkey]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/FrozenKey.html
249+[frozenvalue]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/FrozenValue.html
modified features/object_mapper/custom_codecs/README.md +3 −3
@@ -98,9 +98,9 @@
9898
9999 This also works with [@Field][field] and [@Param][param] annotations.
100100
101-[column]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Column.html
102-[field]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Field.html
103-[param]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Param.html
101+[column]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Column.html
102+[field]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Field.html
103+[param]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Param.html
104104
105105
106106 ## Implicit UDT codecs
modified features/object_mapper/using/README.md +6 −6
@@ -28,9 +28,9 @@
2828 calling `manager#mapper` more than once for the same class will return
2929 the previously generated mapper.
3030
31-[Mapper]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/Mapper.html
32-[MappingManager]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/MappingManager.html
33-[Session]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Session.html
31+[Mapper]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/Mapper.html
32+[MappingManager]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/MappingManager.html
33+[Session]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html
3434
3535 #### Basic CRUD operations
3636
@@ -174,7 +174,7 @@
174174 and `isExhausted()`. Note that iterating the `Result` will consume the
175175 `ResultSet`, and vice-versa.
176176
177-[Result]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/Result.html
177+[Result]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/Result.html
178178
179179 ### Accessors
180180
@@ -224,7 +224,7 @@
224224 ResultSet insert(@Param("u") UUID userId, @Param("n") String name);
225225 ```
226226
227-[param]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/Param.html
227+[param]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/Param.html
228228
229229 If a method argument is a Java enumeration, it must be annotated with
230230 `@Enumerated` to indicate how to convert it to a CQL type (the rules are
@@ -292,4 +292,4 @@
292292 public ListenableFuture<Result<User>> getAllAsync();
293293 ```
294294
295-[@QueryParameters]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/mapping/annotations/QueryParameters.html
295+[@QueryParameters]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/mapping/annotations/QueryParameters.html
modified features/paging/README.md +4 −4
@@ -171,8 +171,8 @@
171171 }
172172 ```
173173
174-[result_set]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ResultSet.html
175-[paging_state]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PagingState.html
174+[result_set]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ResultSet.html
175+[paging_state]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PagingState.html
176176
177177
178178 Due to internal implementation details, `PagingState` instances are not
@@ -214,8 +214,8 @@
214214 implementing your own validation logic (for example, signing the raw
215215 state with a private key).
216216
217-[gpsu]: http://www.datastax.com/drivers/java/2.2/com/datastax/driver/core/ExecutionInfo.html#getPagingStateUnsafe()
218-[spsu]: http://www.datastax.com/drivers/java/2.2/com/datastax/driver/core/Statement.html#setPagingStateUnsafe(byte[])
217+[gpsu]: http://www.datastax.com/drivers/java/3.0/com/datastax/driver/core/ExecutionInfo.html#getPagingStateUnsafe()
218+[spsu]: http://www.datastax.com/drivers/java/3.0/com/datastax/driver/core/Statement.html#setPagingStateUnsafe(byte[])
219219
220220 ### Offset queries
221221
modified features/pooling/README.md +11 −11
@@ -277,14 +277,14 @@
277277 [newConnectionThreshold][nct] so that enough connections are added by
278278 the time you reach the bottleneck.
279279
280-[result_set_future]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ResultSetFuture.html
281-[pooling_options]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PoolingOptions.html
282-[lbp]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/LoadBalancingPolicy.html
283-[nct]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PoolingOptions.html#setNewConnectionThreshold(com.datastax.driver.core.HostDistance,%20int)
284-[mrpc]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PoolingOptions.html#setMaxRequestsPerConnection(com.datastax.driver.core.HostDistance,%20int)
285-[sits]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PoolingOptions.html#setIdleTimeoutSeconds(int)
286-[rtm]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/SocketOptions.html#getReadTimeoutMillis()
287-[exec_async]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Session.html#executeAsync(com.datastax.driver.core.Statement)
288-[ptm]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PoolingOptions.html#setPoolTimeoutMillis(int)
289-[nhae]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/exceptions/NoHostAvailableException.html
290-[get_state]:http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Session.html#getState()
280+[result_set_future]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ResultSetFuture.html
281+[pooling_options]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PoolingOptions.html
282+[lbp]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/LoadBalancingPolicy.html
283+[nct]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PoolingOptions.html#setNewConnectionThreshold(com.datastax.driver.core.HostDistance,%20int)
284+[mrpc]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PoolingOptions.html#setMaxRequestsPerConnection(com.datastax.driver.core.HostDistance,%20int)
285+[sits]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PoolingOptions.html#setIdleTimeoutSeconds(int)
286+[rtm]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SocketOptions.html#getReadTimeoutMillis()
287+[exec_async]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#executeAsync(com.datastax.driver.core.Statement)
288+[ptm]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PoolingOptions.html#setPoolTimeoutMillis(int)
289+[nhae]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/exceptions/NoHostAvailableException.html
290+[get_state]:http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#getState()
modified features/query_timestamps/README.md +3 −3
@@ -16,7 +16,7 @@
1616
1717 ### Client-side generation
1818
19-This is enabled by default if you're using the driver 2.2 and a version
19+This is enabled by default if you're using the driver 3.0 and a version
2020 of Cassandra that supports [native protocol](../native_protocol) v3 or
2121 above.
2222
@@ -42,8 +42,8 @@
4242 session.execute(statement);
4343 ```
4444
45-[tsg]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/TimestampGenerator.html
46-[amtsg]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/AtomicMonotonicTimestampGenerator.html
45+[tsg]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/TimestampGenerator.html
46+[amtsg]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/AtomicMonotonicTimestampGenerator.html
4747
4848
4949 ### Server-side generation
modified features/speculative_execution/README.md +11 −11
@@ -108,8 +108,8 @@
108108 cluster.getConfiguration().getQueryOptions().setDefaultIdempotence(true);
109109 ```
110110
111-[isIdempotent]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Statement.html#isIdempotent()
112-[QueryBuilder]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/querybuilder/QueryBuilder.html
111+[isIdempotent]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Statement.html#isIdempotent()
112+[QueryBuilder]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/querybuilder/QueryBuilder.html
113113
114114 ### Enabling speculative executions
115115
@@ -118,7 +118,7 @@
118118 `Cluster`. This policy defines the threshold after which a new
119119 speculative execution will be triggered.
120120
121-[sep]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/SpeculativeExecutionPolicy.html
121+[sep]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/SpeculativeExecutionPolicy.html
122122
123123 Two implementations are provided with the driver:
124124
@@ -146,7 +146,7 @@
146146 * if no response has been received at t0 + 1000 milliseconds, start
147147 another speculative execution on a third node.
148148
149-[csep]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/ConstantSpeculativeExecutionPolicy.html
149+[csep]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/ConstantSpeculativeExecutionPolicy.html
150150
151151 #### [PercentileSpeculativeExecutionPolicy][psep]
152152
@@ -207,9 +207,9 @@
207207 logger (see the [Logging](../logging/) section). In that case, you would
208208 create a single tracker object and share it with both components.
209209
210-[psep]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/PercentileSpeculativeExecutionPolicy.html
210+[psep]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/PercentileSpeculativeExecutionPolicy.html
211211 [hdr]: http://hdrhistogram.github.io/HdrHistogram/
212-[phpt]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/PerHostPercentileTracker.html
212+[phpt]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PerHostPercentileTracker.html
213213
214214 #### Using your own
215215
@@ -263,7 +263,7 @@
263263 The only impact is that all executions of the same query always share
264264 the same query plan, so each host will be used by at most one execution.
265265
266-[retry_policy]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/policies/RetryPolicy.html
266+[retry_policy]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/RetryPolicy.html
267267
268268 ### Tuning and practical details
269269
@@ -278,8 +278,8 @@
278278 It should only be a few percents of the total number of requests
279279 ([cluster.getMetrics().getRequestsTimer().getCount()][request_metric]).
280280
281-[se_metric]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metrics.Errors.html#getSpeculativeExecutions()
282-[request_metric]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Metrics.html#getRequestsTimer()
281+[se_metric]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metrics.Errors.html#getSpeculativeExecutions()
282+[request_metric]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metrics.html#getRequestsTimer()
283283
284284 #### Stream id exhaustion
285285
@@ -308,8 +308,8 @@
308308 using, you can check with
309309 [cluster.getConfiguration().getProtocolOptions().getProtocolVersion()][protocol_version].
310310
311-[session_state]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/Session.State.html
312-[protocol_version]: http://docs.datastax.com/en/drivers/java/2.2/com/datastax/driver/core/ProtocolOptions.html#getProtocolVersion()
311+[session_state]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.State.html
312+[protocol_version]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/ProtocolOptions.html#getProtocolVersion()
313313
314314 #### Request ordering and client timestamps
315315