mirror of
https://github.com/fankes/moshi.git
synced 2025-10-19 16:09:21 +08:00
Enable syntax highlighting for code snippets.
This commit is contained in:
@@ -334,7 +334,7 @@ public @interface HexColor {
|
|||||||
|
|
||||||
Next apply this `@HexColor` annotation to the appropriate field:
|
Next apply this `@HexColor` annotation to the appropriate field:
|
||||||
|
|
||||||
```
|
```java
|
||||||
class Rectangle {
|
class Rectangle {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
@@ -344,7 +344,7 @@ class Rectangle {
|
|||||||
|
|
||||||
And finally define a type adapter to handle it:
|
And finally define a type adapter to handle it:
|
||||||
|
|
||||||
```
|
```java
|
||||||
/** Converts strings like #ff0000 to the corresponding color ints. */
|
/** Converts strings like #ff0000 to the corresponding color ints. */
|
||||||
class ColorAdapter {
|
class ColorAdapter {
|
||||||
@ToJson String toJson(@HexColor int rgb) {
|
@ToJson String toJson(@HexColor int rgb) {
|
||||||
|
Reference in New Issue
Block a user