Class WriteMode
This class is a tagged union. Tagged unions instances are always
associated to a specific tag. This means only one of the isAbc()
methods will return true. You can use tag() to determine the
tag associated with this instance.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverwrite if the given "rev" matches the existing file's "rev".inthashCode()booleanisAdd()booleanbooleanisUpdate()tag()Returns the tag for this instance.toString()Returns a String representation of this object formatted for easier readability.static WriteModeReturns an instance ofWriteModethat has its tag set toWriteMode.Tag.UPDATE.
-
Field Details
-
ADD
Do not overwrite an existing file if there is a conflict. The autorename strategy is to append a number to the file name. For example, "document.txt" might become "document (2).txt". -
OVERWRITE
Always overwrite the existing file. The autorename strategy is the same as it is forADD.
-
-
Method Details
-
tag
Returns the tag for this instance.This class is a tagged union. Tagged unions instances are always associated to a specific tag. This means only one of the
isXyz()methods will returntrue. Callers are recommended to use the tag value in aswitchstatement to properly handle the different values for thisWriteMode.- Returns:
- the tag for this instance.
-
isAdd
public boolean isAdd()- Returns:
trueif this instance is tagged asWriteMode.Tag.ADD,falseotherwise.
-
isOverwrite
public boolean isOverwrite()- Returns:
trueif this instance is tagged asWriteMode.Tag.OVERWRITE,falseotherwise.
-
isUpdate
public boolean isUpdate()- Returns:
trueif this instance is tagged asWriteMode.Tag.UPDATE,falseotherwise.
-
update
Returns an instance ofWriteModethat has its tag set toWriteMode.Tag.UPDATE.Overwrite if the given "rev" matches the existing file's "rev". The supplied value should be the latest known "rev" of the file, for example, from
FileMetadata, from when the file was last downloaded by the app. This will cause the file on the Dropbox servers to be overwritten if the given "rev" matches the existing file's current "rev" on the Dropbox servers. The autorename strategy is to append the string "conflicted copy" to the file name. For example, "document.txt" might become "document (conflicted copy).txt" or "document (Panda's conflicted copy).txt".- Parameters:
value- value to assign to this instance.- Returns:
- Instance of
WriteModewith its tag set toWriteMode.Tag.UPDATE. - Throws:
IllegalArgumentException- ifvalueis shorter than 9, does not match pattern "[0-9a-f]+", or isnull.
-
getUpdateValue
Overwrite if the given "rev" matches the existing file's "rev". The supplied value should be the latest known "rev" of the file, for example, fromFileMetadata, from when the file was last downloaded by the app. This will cause the file on the Dropbox servers to be overwritten if the given "rev" matches the existing file's current "rev" on the Dropbox servers. The autorename strategy is to append the string "conflicted copy" to the file name. For example, "document.txt" might become "document (conflicted copy).txt" or "document (Panda's conflicted copy).txt".This instance must be tagged as
WriteMode.Tag.UPDATE.- Returns:
- The
Stringvalue associated with this instance ifisUpdate()istrue. - Throws:
IllegalStateException- IfisUpdate()isfalse.
-
hashCode
public int hashCode() -
equals
-
toString
-
toStringMultiline
Returns a String representation of this object formatted for easier readability.The returned String may contain newlines.
- Returns:
- Formatted, multiline String representation of this object
-