Skip to content

Commit b33d52b

Browse files
authored
Bson javadoc improvements (#1883)
Fixed no comment warning in BinaryVector Improved BsonBinary asUuid documentation Improved BsonBinarySubType isUuid documentation JAVA-6086
1 parent ff7ebe9 commit b33d52b

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

bson/src/main/org/bson/BinaryVector.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
* @since 5.3
3333
*/
3434
public abstract class BinaryVector {
35+
/**
36+
* The BinaryVector logger
37+
*/
3538
protected static final Logger LOGGER = Loggers.getLogger("BinaryVector");
3639
private final DataType dataType;
3740

bson/src/main/org/bson/BsonBinary.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,14 @@ public BsonBinary(final UUID uuid, final UuidRepresentation uuidRepresentation)
127127
}
128128

129129
/**
130-
* Returns the binary as a UUID. The binary type must be 4.
130+
* Returns the binary as a UUID.
131+
*
132+
* <p><strong>Note:</strong>The BsonBinary subtype must be {@link BsonBinarySubType#UUID_STANDARD}.</p>
131133
*
132134
* @return the uuid
135+
* @throws BsonInvalidOperationException if BsonBinary subtype is not {@link BsonBinarySubType#UUID_STANDARD}
136+
* @see #asUuid(UuidRepresentation)
137+
* @see BsonBinarySubType
133138
* @since 3.9
134139
*/
135140
public UUID asUuid() {
@@ -162,8 +167,15 @@ public BinaryVector asVector() {
162167
/**
163168
* Returns the binary as a UUID.
164169
*
165-
* @param uuidRepresentation the UUID representation
170+
* <p><strong>Note:</strong>The BsonBinary subtype must be either {@link BsonBinarySubType#UUID_STANDARD} or
171+
* {@link BsonBinarySubType#UUID_LEGACY}.</p>
172+
*
173+
* @param uuidRepresentation the UUID representation, must be {@link UuidRepresentation#STANDARD} or
174+
* {@link UuidRepresentation#JAVA_LEGACY}
166175
* @return the uuid
176+
* @throws BsonInvalidOperationException if the BsonBinary subtype is incompatible with the given {@code uuidRepresentation}, or if
177+
* the {@code uuidRepresentation} is not {@link UuidRepresentation#STANDARD} or
178+
* {@link UuidRepresentation#JAVA_LEGACY}.
167179
* @since 3.9
168180
*/
169181
public UUID asUuid(final UuidRepresentation uuidRepresentation) {

bson/src/main/org/bson/BsonBinarySubType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public enum BsonBinarySubType {
9393
* Returns true if the given value is a UUID subtype.
9494
*
9595
* @param value the subtype value as a byte.
96-
* @return true if value is a UUID subtype.
96+
* @return true if value has a {@link #UUID_STANDARD} or {@link #UUID_LEGACY} subtype.
9797
* @since 3.4
9898
*/
9999
public static boolean isUuid(final byte value) {

0 commit comments

Comments
 (0)