kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 44e46587819e9583feb6eb5ae97f1a928c1a66232e13bf8bd4d14315c1926ed5 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-01-22 18:05 +01:00 |
| Committer | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-01-22 18:05 +01:00 |
| Parents | 641f8153a8fc |
1 file changed
modified manual/custom_codecs/README.md +5 −5
| @@ -89,7 +89,7 @@ | ||
| 89 | 89 | byte[] b = new byte[bytes.remaining()]; |
| 90 | 90 | // always duplicate the ByteBuffer instance before consuming it! |
| 91 | 91 | bytes.duplicate().get(b); |
| 92 | - return (T)objectMapper.readValue(b, toJacksonJavaType()); | |
| 92 | + return (T) objectMapper.readValue(b, toJacksonJavaType()); | |
| 93 | 93 | } catch (IOException e) { |
| 94 | 94 | throw new InvalidTypeException(e.getMessage(), e); |
| 95 | 95 | } |
| @@ -98,7 +98,7 @@ | ||
| 98 | 98 | @Override |
| 99 | 99 | public String format(T value) throws InvalidTypeException { |
| 100 | 100 | if (value == null) |
| 101 | - return NULL; | |
| 101 | + return "NULL"; | |
| 102 | 102 | String json; |
| 103 | 103 | try { |
| 104 | 104 | json = objectMapper.writeValueAsString(value); |
| @@ -111,13 +111,13 @@ | ||
| 111 | 111 | @Override |
| 112 | 112 | @SuppressWarnings("unchecked") |
| 113 | 113 | public T parse(String value) throws InvalidTypeException { |
| 114 | - if (value == null || value.isEmpty() || value.equals(NULL)) | |
| 114 | + if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) | |
| 115 | 115 | return null; |
| 116 | 116 | if (value.charAt(0) != '\'' || value.charAt(value.length() - 1) != '\'') |
| 117 | 117 | throw new InvalidTypeException("JSON strings must be enclosed by single quotes"); |
| 118 | 118 | String json = value.substring(1, value.length() - 1).replace("''", "'"); |
| 119 | 119 | try { |
| 120 | - return (T)objectMapper.readValue(json, toJacksonJavaType()); | |
| 120 | + return (T) objectMapper.readValue(json, toJacksonJavaType()); | |
| 121 | 121 | } catch (IOException e) { |
| 122 | 122 | throw new InvalidTypeException(e.getMessage(), e); |
| 123 | 123 | } |
| @@ -126,7 +126,7 @@ | ||
| 126 | 126 | protected JavaType toJacksonJavaType() { |
| 127 | 127 | return TypeFactory.defaultInstance().constructType(getJavaType().getType()); |
| 128 | 128 | } |
| 129 | - | |
| 129 | + | |
| 130 | 130 | } |
| 131 | 131 | ``` |
| 132 | 132 |