+
+ @Override
+ protected final JSONCodec<?> enumCodec(final EnumTypeDefinition type) {
+ return new QuotedJSONCodec<>(EnumStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> identityRefCodec(final IdentityrefTypeDefinition type, final QNameModule module) {
+ return new IdentityrefJSONCodec(getSchemaContext(), module);
+ }
+
+ @Override
+ protected final JSONCodec<?> int8Codec(final Int8TypeDefinition type) {
+ return new NumberJSONCodec<>(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> int16Codec(final Int16TypeDefinition type) {
+ return new NumberJSONCodec<>(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> int32Codec(final Int32TypeDefinition type) {
+ return new NumberJSONCodec<>(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> int64Codec(final Int64TypeDefinition type) {
+ return wrapIntegerCodec(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> stringCodec(final StringTypeDefinition type) {
+ return new QuotedJSONCodec<>(StringStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> uint8Codec(final Uint8TypeDefinition type) {
+ return new NumberJSONCodec<>(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> uint16Codec(final Uint16TypeDefinition type) {
+ return new NumberJSONCodec<>(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> uint32Codec(final Uint32TypeDefinition type) {
+ return new NumberJSONCodec<>(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> uint64Codec(final Uint64TypeDefinition type) {
+ return wrapIntegerCodec(AbstractIntegerStringCodec.from(type));
+ }
+
+ @Override
+ protected final JSONCodec<?> unionCodec(final UnionTypeDefinition type, final List<JSONCodec<?>> codecs) {
+ return UnionJSONCodec.create(type, codecs);
+ }
+
+ @Override
+ protected final JSONCodec<?> unknownCodec(final UnknownTypeDefinition type) {
+ return NullJSONCodec.INSTANCE;
+ }
+
+ @Override
+ protected abstract JSONCodec<?> instanceIdentifierCodec(InstanceIdentifierTypeDefinition type);
+
+ // Returns a one-off factory for the purposes of normalizing an anydata tree.
+ //
+ // FIXME: 6.0.0: this is really ugly, as we should be able to tell if the new context is the same as ours and
+ // whether our cache is thread-safe -- in which case we should just return this.
+ // The supplier/cache/factory layout needs to be reworked so that this call ends up being equivalent
+ // to JSONCodecFactorySupplier.getShared() in case this factory is not thread safe.
+ //
+ // The above is not currently possible, as we cannot reference JSONCodecFactorySupplier from the
+ // factory due to that potentially creating a circular reference.
+ final JSONCodecFactory rebaseTo(final SchemaContext newSchemaContext) {
+ return rebaseTo(newSchemaContext, new LazyCodecCache<>());
+ }
+
+ abstract JSONCodecFactory rebaseTo(SchemaContext newSchemaContext, CodecCache<JSONCodec<?>> newCache);
+
+ abstract JSONCodec<?> wrapDecimalCodec(DecimalStringCodec decimalCodec);
+
+ abstract JSONCodec<?> wrapIntegerCodec(AbstractIntegerStringCodec<?, ?> integerCodec);