Package org.webpki.cbor
Class CBORTag
java.lang.Object
org.webpki.cbor.CBORObject
org.webpki.cbor.CBORTag
- All Implemented Interfaces:
Cloneable
,Comparable<CBORObject>
Class for holding CBOR
tag
objects.
Tagged objects are based on CBOR major type 6. This implementation accepts three variants of tags:
The purpose of the last construct is to provide a
generic way of adding an object type identifier in the
form of a URL or other text data to CBOR objects.
The CBOR tag must in this case be 1010
.
Example:
1010(["https://example.com/myobject", {
"amount": "145.00",
"currency": "USD"
}])
Note that the bignum
type is dealt with
as a specific primitive, in spite of being a tagged object.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
COTX tag: 1010static final int
DATE tag: 0 -
Constructor Summary
ConstructorDescriptionCBORTag
(long tagNumber, CBORObject object) Creates a CBOR tagged object.CBORTag
(String typeUrl, CBORObject object) Creates a COTX-tagged object. -
Method Summary
Modifier and TypeMethodDescriptionGet tagged object.long
Get tag number.Methods inherited from class org.webpki.cbor.CBORObject
checkForUnread, clone, compareTo, encode, equals, getArray, getBigInteger, getBoolean, getBytes, getFloat16, getFloat32, getFloat64, getInt16, getInt32, getInt64, getInt8, getMap, getString, getTag, getUint16, getUint32, getUint64, getUint8, hashCode, isNull, scan, toDiagnosticNotation, toString
-
Field Details
-
RESERVED_TAG_COTX
public static final int RESERVED_TAG_COTXCOTX tag: 1010- See Also:
-
RESERVED_TAG_DATE
public static final int RESERVED_TAG_DATEDATE tag: 0- See Also:
-
-
Constructor Details
-
CBORTag
Creates a COTX-tagged object.- Parameters:
typeUrl
- Type URL (or other string)object
- Object
-
CBORTag
Creates a CBOR tagged object.- Parameters:
tagNumber
- Tag numberobject
- Object
-
-
Method Details
-
getTaggedObject
Get tagged object.- Returns:
- CBOR object
-
getTagNumber
public long getTagNumber()Get tag number.- Returns:
- Tag number
-