Interface FieldWrapper


public interface FieldWrapper
A wrapper interface for accessing and manipulating object fields.

This interface provides a unified way to get and set field values on objects, abstracting the underlying reflection operations. It handles different types of fields including regular fields and optional fields, providing type-safe access patterns.

Implementations of this interface are typically created by PropertyPathSegment implementations to handle field access for specific property path segments.

This interface is used internally by the Doma framework for property mapping and should not be used directly by application code.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    get(Object obj)
    Retrieves the value of this field from the specified object.
    Returns the type of this field.
    void
    set(Object obj, Object value)
    Sets the value of this field on the specified object.
  • Method Details

    • get

      Object get(Object obj) throws WrapException
      Retrieves the value of this field from the specified object.
      Parameters:
      obj - the object from which to retrieve the field value
      Returns:
      the field value, which may be null
      Throws:
      WrapException - if an error occurs during field access
    • set

      void set(Object obj, Object value) throws WrapException
      Sets the value of this field on the specified object.
      Parameters:
      obj - the object on which to set the field value
      value - the value to set, which may be null
      Throws:
      WrapException - if an error occurs during field access
    • getType

      Class<?> getType()
      Returns the type of this field.

      For optional fields, this returns the element type rather than the Optional type itself.

      Returns:
      the field type