Class ConflictResolution
- java.lang.Object
-
- com.mongodb.stitch.core.services.mongodb.remote.sync.ConflictResolution
-
- Direct Known Subclasses:
ConflictResolution.WithDocument
public abstract class ConflictResolution extends Object
ConflictResolution
represents a resolution to a MongoDB Mobile Sync conflict. Conflicts occur when a local pending write conflicts with an incoming remote change. The user-defined conflict handler method in aConflictHandler
returns aConflictResolution
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConflictResolution.ConflictResolutionType
The different ways of resolving a conflict.static class
ConflictResolution.WithDocument<T>
ConflictResolution.WithDocument
resolves a conflict by providing a new document that should be treated as the new source of truth.
-
Constructor Summary
Constructors Constructor Description ConflictResolution()
-
Method Summary
Modifier and Type Method Description static ConflictResolution
fromLocal()
Returns theConflictResolution.FromLocal
conflict resolution.static ConflictResolution
fromRemote()
Returns theConflictResolution.FromRemote
conflict resolution.abstract ConflictResolution.ConflictResolutionType
getType()
Returns the enum type of thisConflictResolution
.static <T> ConflictResolution
withDocument(T fullDocumentForResolution)
Returns a newConflictResolution.WithDocument
resolution with the provided document.
-
-
-
Method Detail
-
withDocument
public static <T> ConflictResolution withDocument(T fullDocumentForResolution)
Returns a newConflictResolution.WithDocument
resolution with the provided document.- Type Parameters:
T
- The Java type of the full document.- Parameters:
fullDocumentForResolution
- The object representing the document that resolves the conflict- Returns:
- the
ConflictResolution.WithDocument
conflict resolution with the provided full document.
-
fromRemote
public static ConflictResolution fromRemote()
Returns theConflictResolution.FromRemote
conflict resolution.- Returns:
- the
ConflictResolution.FromRemote
conflict resolution.
-
fromLocal
public static ConflictResolution fromLocal()
Returns theConflictResolution.FromLocal
conflict resolution.- Returns:
- the
ConflictResolution.FromLocal
conflict resolution.
-
getType
public abstract ConflictResolution.ConflictResolutionType getType()
Returns the enum type of thisConflictResolution
. For internal use only.- Returns:
- the type of this
ConflictResolution
-
-