Class StdReflector

java.lang.Object
tech.ydb.yoj.databind.schema.reflect.StdReflector
All Implemented Interfaces:
Reflector

public final class StdReflector extends Object implements Reflector
Standard Reflector implementation, suitable for most usages. By default, reflecting record classes, Kotlin data classes, POJOs and simple types such as int is supported.

You can override default Reflector by creating a custom SchemaRegistry with your own instance of StdReflector with a different set of type factories, or a wholly different implementation altogether. You then have to pass the SchemaRegistry to *Schema.of(...) methods to use it instead of the default one.

See Also:
  • Field Details

    • instance

      public static final Reflector instance
  • Constructor Details

  • Method Details

    • reflectRootType

      public <T> ReflectType<T> reflectRootType(Class<T> type)
      Description copied from interface: Reflector
      Gets reflection information for a root type, that is, a type that can have a schema: a public concrete class.
      Specified by:
      reflectRootType in interface Reflector
      Type Parameters:
      T - type to get reflection information for
      Parameters:
      type - type to get reflection information for
      Returns:
      basic reflection information for type
    • reflectFieldType

      public ReflectType<?> reflectFieldType(Type genericType, FieldValueType bindingType)
      Description copied from interface: Reflector
      Gets reflection information for a field, potentially a deep sub-field of some type which can have schema.
      Specified by:
      reflectFieldType in interface Reflector
      Parameters:
      genericType - generic type of field to get reflection information for
      bindingType - value type suitable for data-binding of type genericType
      Returns:
      basic reflection information for the field