diff --git a/guava/src/main/java/tools/jackson/datatype/guava/ser/RangeSerializer.java b/guava/src/main/java/tools/jackson/datatype/guava/ser/RangeSerializer.java index ccf7444e..e9ad48bf 100644 --- a/guava/src/main/java/tools/jackson/datatype/guava/ser/RangeSerializer.java +++ b/guava/src/main/java/tools/jackson/datatype/guava/ser/RangeSerializer.java @@ -16,7 +16,30 @@ import tools.jackson.datatype.guava.deser.util.RangeHelper; /** - * Jackson serializer for a Guava {@link Range}. + * Jackson serializer for Guava Range objects with enhanced serialization capabilities. + * When the range property is annotated with {@code @JsonFormat(JsonFormat.Shape.STRING)}, + * it generates bracket notation for a more concise and human-readable representation. + * Otherwise, it defaults to a more verbose standard serialization, explicitly writing out endpoints and bound types. + * + *

+ * Usage Example for bracket notation: + *

{@code
+ *   @JsonFormat(JsonFormat.Shape.STRING)
+ *   private Range r;
+ * }
+ * When the range field is annotated with {@code @JsonFormat(JsonFormat.Shape.STRING)}, the serializer + * will output the range that would look something like: [X..Y] or (X..Y). + *

+ * By default, when the range property lacks the string shape annotation, + * the serializer will output the JSON in following manner: + *
{@code
+ *   {
+ *      "lowerEndpoint": X,
+ *      "lowerBoundType": "CLOSED",
+ *      "upperEndpoint": Y,
+ *      "upperBoundType": "CLOSED"
+ *   }
+ * }
*/ public class RangeSerializer extends StdSerializer> {