Interface CosIdAccessor

All Superinterfaces:
CosIdGetter, CosIdSetter, EnsureId, IdMetadata
All Known Implementing Classes:
CosIdAccessor.NotFound, DefaultCosIdAccessor

public interface CosIdAccessor extends CosIdGetter, CosIdSetter, IdMetadata, EnsureId
CosId accessor for automatic ID injection into objects.

This interface combines multiple capabilities for working with ID fields in objects:

The accessor is used by the CosId framework to automatically find and populate ID fields in objects when they are persisted or processed. This enables a "convention over configuration" approach where ID fields are automatically detected and populated without explicit code.

The interface includes utility methods for checking ID type compatibility and ensuring reflective access to fields.

  • Field Details

    • NOT_FOUND

      static final CosIdAccessor.NotFound NOT_FOUND
      A sentinel value representing a "not found" accessor.

      This is used when no valid ID field can be found in an object, allowing the framework to handle missing ID fields gracefully without null checks.

  • Method Details

    • availableType

      static boolean availableType(Class<?> idType)
      Check if the specified ID type is supported by CosId.

      This method verifies that the provided ID type is one of the supported types for automatic ID injection:

      Parameters:
      idType - The ID type to check
      Returns:
      true if the type is supported, false otherwise
    • ensureAccessible

      static void ensureAccessible(AccessibleObject accessibleObject)
      Ensure that the specified accessible object (field/method) is accessible.

      This utility method makes the provided accessible object accessible if it is not already, allowing the framework to access private or protected fields and methods for ID injection.

      Parameters:
      accessibleObject - The object to make accessible