11package com .apicatalog .cborld ;
22
33import com .apicatalog .cborld .config .ConfigV1 ;
4+ import com .apicatalog .cborld .decoder .Decoder ;
45import com .apicatalog .cborld .decoder .DecoderBuilder ;
56import com .apicatalog .cborld .decoder .DecoderConfig ;
7+ import com .apicatalog .cborld .encoder .Encoder ;
68import com .apicatalog .cborld .encoder .EncoderBuilder ;
79import com .apicatalog .cborld .encoder .EncoderConfig ;
810
911/**
10- * High level API to process CBOR-LD.
12+ * High-level entry point for working with CBOR-LD.
13+ * <p>
14+ * Provides static factory methods to configure and create CBOR-LD
15+ * {@link Encoder} and {@link Decoder} instances.
1116 */
1217public class CborLd {
1318
14- public static final byte LEADING_BYTE = (byte ) 0xD9 ; // tag
19+ /** CBOR tag leading byte. */
20+ public static final byte LEADING_BYTE = (byte ) 0xD9 ;
1521
16- public static final byte [] VERSION_1_BYTES = new byte [] { (byte ) 0xCB , 0x1D };
17- public static final byte VERSION_06_BYTE = (byte ) 0x06 ;
18- public static final byte VERSION_05_BYTE = (byte ) 0x05 ;
22+ /** CBOR-LD version 1 identifier. */
23+ static final byte [] VERSION_1_BYTES = new byte [] { (byte ) 0xCB , 0x1D };
24+ /** CBOR-LD legacy version 0.6 identifier. */
25+ static final byte VERSION_06_BYTE = (byte ) 0x06 ;
26+ /** CBOR-LD legacy version 0.5 identifier. */
27+ static final byte VERSION_05_BYTE = (byte ) 0x05 ;
1928
29+ /** Utility class — not meant to be instantiated. */
2030 protected CborLd () {
2131 /* protected */ }
2232
2333 /**
2434 * Creates a new {@link DecoderBuilder} instance with default configuration.
2535 * <p>
26- * The builder is initialized with all available format version decoders.
36+ * The builder is initialized with default settings provided by
37+ * {@link ConfigV1}.
2738 *
2839 * @return a new {@link DecoderBuilder} instance
2940 */
@@ -32,13 +43,13 @@ public static DecoderBuilder createDecoder() {
3243 }
3344
3445 /**
35- * Creates a new {@link DecoderBuilder} instance with the specified decoder
36- * configurations .
46+ * Creates a new {@link DecoderBuilder} instance using the provided decoder
47+ * configuration(s) .
3748 * <p>
38- * This method allows initializing the builder with one or more custom
39- * {@link DecoderConfig} options to control decoding behavior .
49+ * This allows customization of decoding behavior by specifying one or more
50+ * {@link DecoderConfig} options.
4051 *
41- * @param config one or more initial decoder configurations
52+ * @param config one or more decoder configurations
4253 * @return a new {@link DecoderBuilder} instance
4354 */
4455 public static DecoderBuilder createDecoder (DecoderConfig ... config ) {
@@ -49,8 +60,8 @@ public static DecoderBuilder createDecoder(DecoderConfig... config) {
4960 * Creates a new {@link DecoderBuilder} instance for the specified CBOR-LD
5061 * format version(s).
5162 * <p>
52- * This method allows initializing the builder with support for specific
53- * {@link CborLdVersion}s only .
63+ * Use this method to explicitly support only certain {@link CborLdVersion}s
64+ * during decoding .
5465 *
5566 * @param version one or more supported CBOR-LD format versions
5667 * @return a new {@link DecoderBuilder} instance
@@ -60,27 +71,35 @@ public static DecoderBuilder createDecoder(CborLdVersion... version) {
6071 }
6172
6273 /**
63- * Create a new {@link EncoderBuilder} allowing to configure an encoder. The
64- * builder is initialized by {@link ConfigV1}.
65- *
74+ * Creates a new {@link EncoderBuilder} instance using the default
75+ * configuration.
76+ * <p>
77+ * The builder is initialized with default settings provided by
78+ * {@link ConfigV1}.
79+ *
6680 * @return a new {@link EncoderBuilder} instance
67- *
6881 */
6982 public static EncoderBuilder createEncoder () {
7083 return createEncoder (ConfigV1 .INSTANCE );
7184 }
7285
7386 /**
74- * Create a new {@link EncoderBuilder} allowing to configure an encoder .
75- *
76- * @param config an initial configuration
87+ * Creates a new {@link EncoderBuilder} instance with a custom configuration .
88+ *
89+ * @param config the encoder configuration to apply
7790 * @return a new {@link EncoderBuilder} instance
78- *
7991 */
8092 public static EncoderBuilder createEncoder (EncoderConfig config ) {
8193 return EncoderBuilder .of (config );
8294 }
8395
96+ /**
97+ * Creates a new {@link EncoderBuilder} instance for the specified CBOR-LD
98+ * format version.
99+ *
100+ * @param version the CBOR-LD version to use
101+ * @return a new {@link EncoderBuilder} instance
102+ */
84103 public static EncoderBuilder createEncoder (CborLdVersion version ) {
85104 return EncoderBuilder .of (version );
86105 }
0 commit comments