Class CdoSnapshot

java.lang.Object
org.javers.core.graph.Cdo
org.javers.core.metamodel.object.CdoSnapshot

public final class CdoSnapshot extends Cdo
Historical state of a domain object captured as the property->value Map. Values and primitives are stored 'by value'. Referenced Entities and ValueObjects are stored 'by reference' using GlobalId
  • Method Details

    • getWrappedCdo

      public Optional<Object> getWrappedCdo()
      Specified by:
      getWrappedCdo in class Cdo
      Returns:
      Optional.EMPTY
    • getGlobalId

      public GlobalId getGlobalId()
      Specified by:
      getGlobalId in class Cdo
    • size

      public int size()
    • getPropertyValue

      public Object getPropertyValue(String propertyName)
      Specified by:
      getPropertyValue in class Cdo
    • getPropertyValue

      public Object getPropertyValue(Property property)
      returns default values for null primitives
      Specified by:
      getPropertyValue in class Cdo
    • getChanged

      public List<String> getChanged()
      List of propertyNames changed with this snapshot (comparing to latest from repository).
      For initial snapshot, returns all properties.
    • hasChangeAt

      public boolean hasChangeAt(String propertyName)
    • isFirstVersion

      public boolean isFirstVersion()
    • isNull

      public boolean isNull(Property property)
      Specified by:
      isNull in class Cdo
    • getCommitId

      public CommitId getCommitId()
    • getCommitMetadata

      public CommitMetadata getCommitMetadata()
    • stateEquals

      public boolean stateEquals(Object o)
    • getState

      public CdoSnapshotState getState()
    • isInitial

      public boolean isInitial()
    • isInstance

      public boolean isInstance()
    • isTerminal

      public boolean isTerminal()
    • isUpdate

      public boolean isUpdate()
    • getType

      public SnapshotType getType()
    • getVersion

      public long getVersion()
      Object version number.
      Initial snapshot of given object has version 1, next has version 2.

      Warning! Version field was added in JaVers v. 1.4.4. All snapshots persisted in JaversRepository before this release have version 0.
      If it isn't OK for you, run manual DB update. See release-notes for v. 1.4.4
      Since:
      1.4.4
    • toString

      public String toString()
      Overrides:
      toString in class Cdo
    • stateWithAllPrimitives

      public CdoSnapshotState stateWithAllPrimitives()
      Original state enriched with default primitive values (like boolean false).
    • isValueObject

      public boolean isValueObject()
    • isTerminalVO

      public boolean isTerminalVO()