Record Class InsertResultImpl

java.lang.Object
java.lang.Record
com.altibase.document.impl.InsertResultImpl
Record Components:
keyValue - 삽입된 문서의 키 값
keyType - 삽입된 키의 자바 Class 타입
affectedDocCount - 영향을 받은 문서의 수 (일반적으로 1)
All Implemented Interfaces:
InsertResult, UpdateResult

public record InsertResultImpl(Object keyValue, Class<?> keyType, long affectedDocCount) extends Record implements InsertResult
InsertResult 인터페이스의 기본 구현 레코드이다.

삽입 연산의 결과로 얻은 키 값, 키 타입, 영향을 받은 문서 수를 담는 불변(Immutable) 데이터 객체로 동작한다.

Since:
1.0
See Also:
  • Constructor Details

    • InsertResultImpl

      public InsertResultImpl(Object keyValue, Class<?> keyType, long affectedDocCount)
      Creates an instance of a InsertResultImpl record class.
      Parameters:
      keyValue - the value for the keyValue record component
      keyType - the value for the keyType record component
      affectedDocCount - the value for the affectedDocCount record component
  • Method Details

    • getKeyValue

      public Object getKeyValue()
      삽입된 문서의 키 값을 Object 타입으로 반환한다.

      반환된 값은 실제 키 타입에 맞게 캐스팅하여 사용해야 한다. 타입 안전성이 필요하다면 getIntegerKey(), getStringKey() 등 타입별 편의 메서드 사용을 권장한다.

      Specified by:
      getKeyValue in interface InsertResult
      Returns:
      키 값 (Object 타입)
    • getKeyType

      public Class<?> getKeyType()
      삽입된 문서의 키에 해당하는 자바 Class 타입을 반환한다.

      이 정보는 타입별 편의 메서드 내부에서 타입 검증을 위해 사용된다.

      Specified by:
      getKeyType in interface InsertResult
      Returns:
      키의 Class 타입
    • getAffectedDocCount

      public long getAffectedDocCount()
      연산으로 인해 영향을 받은 문서의 수를 반환한다.

      예를 들어, deleteMany 연산의 경우 삭제된 문서의 총 개수를 반환하고, replaceOne 연산의 경우 교체된 문서의 수(일반적으로 1 또는 0)를 반환한다.

      Specified by:
      getAffectedDocCount in interface UpdateResult
      Returns:
      갱신, 교체, 또는 삭제된 문서의 총 개수
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • keyValue

      public Object keyValue()
      Returns the value of the keyValue record component.
      Returns:
      the value of the keyValue record component
    • keyType

      public Class<?> keyType()
      Returns the value of the keyType record component.
      Returns:
      the value of the keyType record component
    • affectedDocCount

      public long affectedDocCount()
      Returns the value of the affectedDocCount record component.
      Returns:
      the value of the affectedDocCount record component