Class WriteMode
- java.lang.Object
- 
- com.dropbox.core.v2.files.WriteMode
 
- 
 public final class WriteMode extends java.lang.ObjectYour intent when writing a file to some path. This is used to determine what constitutes a conflict and what the autorename strategy is. In some situations, the conflict behavior is identical: (a) If the target path doesn't refer to anything, the file is always written; no conflict. (b) If the target path refers to a folder, it's always a conflict. (c) If the target path refers to a file with identical contents, nothing gets written; no conflict. The conflict checking differs in the case where there's a file at the target path with contents different from the contents you're trying to write.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 returntrue. You can usetag()to determine the tag associated with this instance.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classWriteMode.TagDiscriminating tag type forWriteMode.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetUpdateValue()Overwrite if the given "rev" matches the existing file's "rev".inthashCode()booleanisAdd()booleanisOverwrite()booleanisUpdate()WriteMode.Tagtag()Returns the tag for this instance.java.lang.StringtoString()java.lang.StringtoStringMultiline()Returns a String representation of this object formatted for easier readability.static WriteModeupdate(java.lang.String value)Returns an instance ofWriteModethat has its tag set toWriteMode.Tag.UPDATE.
 
- 
- 
- 
Field Detail- 
ADDpublic static final WriteMode 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".
 
- 
 - 
Method Detail- 
tagpublic WriteMode.Tag 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.
 
 - 
isAddpublic boolean isAdd() - Returns:
- trueif this instance is tagged as- WriteMode.Tag.ADD,- falseotherwise.
 
 - 
isOverwritepublic boolean isOverwrite() - Returns:
- trueif this instance is tagged as- WriteMode.Tag.OVERWRITE,- falseotherwise.
 
 - 
isUpdatepublic boolean isUpdate() - Returns:
- trueif this instance is tagged as- WriteMode.Tag.UPDATE,- falseotherwise.
 
 - 
updatepublic static WriteMode update(java.lang.String value) Returns an instance ofWriteModethat has its tag set toWriteMode.Tag.UPDATE.Overwrite if the given "rev" matches the existing file's "rev". 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:
- java.lang.IllegalArgumentException- if- valueis shorter than 9, does not match pattern "- [0-9a-f]+", or is- null.
 
 - 
getUpdateValuepublic java.lang.String getUpdateValue() Overwrite if the given "rev" matches the existing file's "rev". 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:
- java.lang.IllegalStateException- If- isUpdate()is- false.
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringMultilinepublic java.lang.String 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
 
 
- 
 
-