1010import software .amazon .smithy .java .core .schema .SchemaExtensionKey ;
1111import software .amazon .smithy .java .core .schema .SchemaExtensionProvider ;
1212import software .amazon .smithy .model .shapes .ShapeType ;
13+ import software .amazon .smithy .utils .SmithyInternalApi ;
1314
1415/**
1516 * Pre-computes CBOR codec data on Schema objects.
1819 * For struct/union schemas: {@link CborMemberLookup} instances for hash-based field matching
1920 * and field name tables for O(1) lookup by memberIndex during serialization.
2021 */
22+ @ SmithyInternalApi
2123public final class CborSchemaExtensions
22- implements SchemaExtensionProvider <CborSchemaExtensions .NativeCborExtension > {
24+ implements SchemaExtensionProvider <CborSchemaExtensions .CborExtension > {
2325
2426 /**
2527 * Extension key for CBOR codec data.
2628 */
27- public static final SchemaExtensionKey <NativeCborExtension > KEY = new SchemaExtensionKey <>();
29+ public static final SchemaExtensionKey <CborExtension > KEY = new SchemaExtensionKey <>();
2830
2931 /**
3032 * Pre-computed CBOR data stored on a Schema.
@@ -33,18 +35,18 @@ public final class CborSchemaExtensions
3335 * @param memberLookup Hash-based member lookup (null for non-structs)
3436 * @param fieldNameTable Indexed by memberIndex: pre-computed name bytes per member (null for non-structs)
3537 */
36- public record NativeCborExtension (
38+ public record CborExtension (
3739 byte [] memberNameBytes ,
3840 CborMemberLookup memberLookup ,
3941 byte [][] fieldNameTable ) {}
4042
4143 @ Override
42- public SchemaExtensionKey <NativeCborExtension > key () {
44+ public SchemaExtensionKey <CborExtension > key () {
4345 return KEY ;
4446 }
4547
4648 @ Override
47- public NativeCborExtension provide (Schema schema ) {
49+ public CborExtension provide (Schema schema ) {
4850 if (schema .isMember ()) {
4951 return forMember (schema );
5052 }
@@ -55,15 +57,15 @@ public NativeCborExtension provide(Schema schema) {
5557 return null ;
5658 }
5759
58- private static NativeCborExtension forMember (Schema schema ) {
60+ private static CborExtension forMember (Schema schema ) {
5961 byte [] memberNameBytes = CborSerializer .encodeMemberName (schema .memberName ());
60- return new NativeCborExtension (memberNameBytes , null , null );
62+ return new CborExtension (memberNameBytes , null , null );
6163 }
6264
63- private static NativeCborExtension forStruct (Schema schema ) {
65+ private static CborExtension forStruct (Schema schema ) {
6466 List <Schema > members = schema .members ();
6567 if (members .isEmpty ()) {
66- return new NativeCborExtension (null , null , null );
68+ return new CborExtension (null , null , null );
6769 }
6870
6971 CborMemberLookup memberLookup = new CborMemberLookup (members );
@@ -78,6 +80,6 @@ private static NativeCborExtension forStruct(Schema schema) {
7880 fieldNameTable [idx ] = CborSerializer .encodeMemberName (m .memberName ());
7981 }
8082
81- return new NativeCborExtension (null , memberLookup , fieldNameTable );
83+ return new CborExtension (null , memberLookup , fieldNameTable );
8284 }
8385}
0 commit comments