Class DefaultValueCodec

java.lang.Object
org.j7m.middleware.codec.defaultcodec.DefaultValueCodec
All Implemented Interfaces:
org.j7m.middleware.codec.api.ValueCodec

public final class DefaultValueCodec extends Object implements org.j7m.middleware.codec.api.ValueCodec
Deterministic Phase 1 value codec.

The codec preserves common immutable values, lists, string-keyed maps, enums, exceptions as safe descriptors, explicit ObjectRef handles, and a small allow-list of trusted schema records used by executable examples. Applications may explicitly register DTO/record schemas with trusted extractor/factory functions. Adjacent versions may add or remove optional fields; payload validation finishes before the target factory runs. Unregistered records are rejected because accessors and constructors are application code. The codec never loads classes from wire type names and does not use Java native serialization.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a default codec with no application schemas.
    DefaultValueCodec(org.j7m.middleware.codec.api.SchemaRegistry schemas)
    Creates a codec with an explicit application schema allowlist.
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(org.j7m.middleware.codec.api.EncodedValue value, Class<?> expectedType, org.j7m.middleware.codec.api.CodecContext context)
    org.j7m.middleware.codec.api.EncodedValue
    encode(Object value, Class<?> declaredType, org.j7m.middleware.codec.api.CodecContext context)

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultValueCodec

      public DefaultValueCodec()
      Creates a default codec with no application schemas.
    • DefaultValueCodec

      public DefaultValueCodec(org.j7m.middleware.codec.api.SchemaRegistry schemas)
      Creates a codec with an explicit application schema allowlist.
      Parameters:
      schemas - immutable trusted schemas; never null
  • Method Details

    • encode

      public org.j7m.middleware.codec.api.EncodedValue encode(Object value, Class<?> declaredType, org.j7m.middleware.codec.api.CodecContext context)
      Specified by:
      encode in interface org.j7m.middleware.codec.api.ValueCodec
    • decode

      public Object decode(org.j7m.middleware.codec.api.EncodedValue value, Class<?> expectedType, org.j7m.middleware.codec.api.CodecContext context)
      Specified by:
      decode in interface org.j7m.middleware.codec.api.ValueCodec