Skip to content

Commit 0e2f14c

Browse files
committed
Minor code edits
1 parent cf80099 commit 0e2f14c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main/java/com/upokecenter/cbor/CBORObject.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,9 @@ <T> T ToObject(java.lang.reflect.Type t,
17811781
return (T)(this);
17821782
}
17831783
if (this.isNull()) {
1784+
// TODO: In next major version, consider returning null
1785+
// here only if this object is untagged, to allow behavior
1786+
// to be customizable by CBORTypeMapper
17841787
return null;
17851788
}
17861789
if (mapper != null) {
@@ -4565,7 +4568,16 @@ public float AsSingle() {
45654568
}
45664569

45674570
/**
4568-
* Gets the value of this object as a text string.
4571+
* Gets the value of this object as a text string.<p>This method is not the
4572+
* "reverse" of the <code>FromObject</code> method in the sense that
4573+
* FromObject can take either a text string or <code>null</code>, but this
4574+
* method can accept only text strings. The <code>ToObject</code> method is
4575+
* closer to a "reverse" version to <code>FromObject</code> than the
4576+
* <code>AsString</code> method: <code>ToObject&lt;string&gt;(cbor)</code> in
4577+
* DotNet, or <code>ToObject(string.class)</code> in Java, will convert a
4578+
* CBOR object to a DotNet or Java string if it represents a text
4579+
* string, or to <code>null</code> if <code>IsNull</code> returns <code>true</code> for
4580+
* the CBOR object, and will fail in other cases.</p>
45694581
* @return Gets this object's string.
45704582
* @throws IllegalStateException This object's type is not a text string (for
45714583
* the purposes of this method, infinity and not-a-number values, but

0 commit comments

Comments
 (0)