Elffuss BraidHub

kikocis/java-driver public

Merge pull request #739 from datastax/doc_fixes

Various doc fixes
Changeset7d5b7df675255dca21b8c81908f278b7b6eadbe523e50a902b6028bce725a656
AuthorOlivier Michallat <olim7t@users.noreply.github.com> · 2016-10-03 09:15 -07:00
CommitterGitHub <noreply@github.com> · 2016-10-03 09:15 -07:00
Parents86638feb1f1b, 299d3531632f

Browse the files at this changeset

3 files changed

modified manual/custom_codecs/extras/README.md +8 −13
@@ -82,9 +82,9 @@
8282
8383 Like for JDK8, there is a codec for each time type:
8484
85-* [InstantCodec][InstantCodec_joda]: [Instant][Instant_joda] to `timestamp`;
86-* [LocalDateCodec][LocalDateCodec_joda]: [LocalDate][LocalDate_joda] to `date`;
87-* [LocalTime][LocalTime_joda]: [LocalTime][LocalTime_joda] to `time`.
85+* [InstantCodec][InstantCodec_joda]: maps [Instant][Instant_joda] to `timestamp`;
86+* [LocalDateCodec][LocalDateCodec_joda]: maps [LocalDate][LocalDate_joda] to `date`;
87+* [LocalTimeCodec][LocalTimeCodec_joda]: maps [LocalTime][LocalTime_joda] to `time`.
8888
8989 ```java
9090 import com.datastax.driver.extras.codecs.joda.InstantCodec;
@@ -127,7 +127,7 @@
127127
128128 * [SimpleTimestampCodec] maps `timestamp` to a primitive Java `long` representing the number of milliseconds since the
129129 Epoch;
130-* [SimpleDateCodec] maps `date` to a primitive Java `int` representing the number of milliseconds since the Epoch.
130+* [SimpleDateCodec] maps `date` to a primitive Java `int` representing the number of days since the Epoch.
131131
132132 There is no extra codec for `time`, because by default the driver already maps that type to a `long` representing the
133133 number of milliseconds since midnight.
@@ -166,14 +166,10 @@
166166 // state saved as 0
167167 ```
168168
169-Note that if you registered both codecs at the same time, there would be a problem: because `session.execute` uses a
170-[simple statement](../../statements/simple/), the target CQL type is not known in advance, so the driver picks the first
171-codec that accepts a `State`. So one of the statements would serialize its value to the wrong type, and the request
172-would fail on the server side.
169+Note that if you registered an `EnumNameCodec` and an `EnumOrdinalCodec` _for the same enum_ at the same time, there could be a problem when executing [simple statements](../../statements/simple/), because in a simple statement, the target CQL type of a given query parameter is not known in advance, so the driver, on a best-effort attempt, will pick one or the other, whichever was registered first. If the chosen codec proves to be the wrong one, the request would fail on the server side.
173170
174171 In practice, this is unlikely to happen, because you'll probably stick to a single CQL type for a given enum type;
175-however, if you ever run into that issue, the workaround is to use [prepared statements](../../statements/prepared/),
176-for which the driver knows the CQL type and can pick the exact codec.
172+however, if you ever run into that issue, the workaround is to use [prepared statements](../../statements/prepared/), for which the driver knows the CQL type and can pick the exact codec.
177173
178174 [EnumNameCodec]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/extras/codecs/enums/EnumNameCodec.html
179175 [EnumOrdinalCodec]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/extras/codecs/enums/EnumOrdinalCodec.html
@@ -231,7 +227,7 @@
231227
232228 It requires an explicit dependency on the JSR-353 API and an implementation:
233229
234-```java
230+```xml
235231 <dependency>
236232 <groupId>javax.json</groupId>
237233 <artifactId>javax.json-api</artifactId>
@@ -337,8 +333,7 @@
337333 cluster.getConfiguration().getCodecRegistry()
338334 .register(optionalIntCodec);
339335
340-TypeToken<Optional<Integer>> optionalIntToken = new TypeToken<Optional<Integer>>() {
341-};
336+TypeToken<Optional<Integer>> optionalIntToken = new TypeToken<Optional<Integer>>() {};
342337
343338 // schema: create table example (id int primary key, v int);
344339 PreparedStatement pst = session.prepare("insert into example (id, v) values (?, ?)");
modified manual/object_mapper/using/README.md +2 −2
@@ -192,8 +192,8 @@
192192 }
193193 ```
194194
195-The `MappingManager` can then process this class and generate an
196-implementation:
195+The `MappingManager` can then process this interface and automatically generate an
196+implementation for it:
197197
198198 ```java
199199 UserAccessor userAccessor = manager.createAccessor(UserAccessor.class);
modified manual/osgi/README.md +2 −0
@@ -18,3 +18,5 @@
1818
1919 Please read our [OSGi-specific FAQ section](../../faq/osgi/) to find tips
2020 for troubleshooting OSGi applications.
21+
22+[OSGi]:https://www.osgi.org