Class CBORTag

All Implemented Interfaces:
Cloneable, Comparable<CBORObject>

public class CBORTag extends CBORObject
Class for holding CBOR tag objects.

Tagged objects are based on CBOR major type 6. This implementation accepts three variants of tags:

nnn(CBOR object )
0(ISO date string)
1010([CBOR text string, CBOR object ])

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 Details

    • RESERVED_TAG_COTX

      public static final int RESERVED_TAG_COTX
      COTX tag: 1010
      See Also:
    • RESERVED_TAG_DATE

      public static final int RESERVED_TAG_DATE
      DATE tag: 0
      See Also:
  • Constructor Details

    • CBORTag

      public CBORTag(String typeUrl, CBORObject object)
      Creates a COTX-tagged object.
      Parameters:
      typeUrl - Type URL (or other string)
      object - Object
    • CBORTag

      public CBORTag(long tagNumber, CBORObject object)
      Creates a CBOR tagged object.
      Parameters:
      tagNumber - Tag number
      object - Object
  • Method Details

    • getTaggedObject

      public CBORObject getTaggedObject()
      Get tagged object.
      Returns:
      CBOR object
    • getTagNumber

      public long getTagNumber()
      Get tag number.
      Returns:
      Tag number