Class CosIdAccessor.NotFound

java.lang.Object
me.ahoo.cosid.accessor.CosIdAccessor.NotFound
All Implemented Interfaces:
CosIdAccessor, CosIdGetter, CosIdSetter, EnsureId, IdMetadata
Enclosing interface:
CosIdAccessor

public static class CosIdAccessor.NotFound extends Object implements CosIdAccessor
Sentinel implementation representing a "not found" accessor.

This implementation provides null/default behavior for all accessor methods, allowing the framework to handle cases where no valid ID field is found without explicit null checks throughout the code.

  • Constructor Details

    • NotFound

      public NotFound()
  • Method Details

    • getIdDefinition

      public IdDefinition getIdDefinition()
      Get the ID definition (always returns null for NotFound).
      Specified by:
      getIdDefinition in interface IdMetadata
      Returns:
      null
    • getIdGenerator

      public IdGenerator getIdGenerator()
      Get the ID generator (always returns null for NotFound).
      Specified by:
      getIdGenerator in interface IdMetadata
      Returns:
      null
    • getIdField

      public Field getIdField()
      Get the ID field (always returns null for NotFound).
      Specified by:
      getIdField in interface IdMetadata
      Returns:
      null
    • getId

      public Object getId(Object target)
      Get the ID value from the target object (always returns null for NotFound).
      Specified by:
      getId in interface CosIdGetter
      Parameters:
      target - The target object
      Returns:
      null
    • setId

      public void setId(Object target, Object id)
      Set the ID value on the target object (no-op for NotFound).
      Specified by:
      setId in interface CosIdSetter
      Parameters:
      target - The target object
      id - The ID value to set
    • ensureId

      public boolean ensureId(Object target)
      Ensure the target object has an ID (always returns false for NotFound).
      Specified by:
      ensureId in interface EnsureId
      Parameters:
      target - The target object
      Returns:
      false