Skip to content

Commit 7ea2fa9

Browse files
authored
Adding isAll and isNone as read-only methods (#29809)
1 parent 288f4a3 commit 7ea2fa9

2 files changed

Lines changed: 49 additions & 11 deletions

File tree

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/CopyableFileSmbProperties.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@
1010
* SMB Properties to copy from the source file.
1111
*/
1212
public enum CopyableFileSmbProperties {
13-
/** Enum value none. */
14-
NONE("none"),
1513
/** Enum value file attributes. */
1614
FILE_ATTRIBUTES("fileattributes"),
1715
/** Enum value available. */
1816
CREATED_ON("createdon"),
1917
/** Enum value last written on. */
2018
LAST_WRITTEN_ON("lastwrittenon"),
2119
/** Enum value changed on. */
22-
CHANGED_ON("changedon"),
23-
/** Enum value all. */
24-
ALL("all");
20+
CHANGED_ON("changedon");
2521

2622
private final String value;
2723
CopyableFileSmbProperties(String value) {

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/CopyableFileSmbPropertiesList.java

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ public CopyableFileSmbPropertiesList() {
2525
isSetChangedOn = false;
2626
}
2727

28-
/***
29-
* @return a flag indicating whether file attributes should be copied from source file.
28+
/**
29+
* Specifies whether file attributes should be copied from source file.
30+
*
31+
* @return {@code true} if file attributes should be copied.
3032
*/
3133
public Boolean isFileAttributes() {
3234
return isSetFileAttributes;
3335

3436
}
3537

3638
/**
39+
* Specify whether file attributes should be copied from source file.
40+
*
3741
* @param fileAttributes Flag indicating whether to copy file attributes from source file
3842
* @return the updated {@link CopyableFileSmbPropertiesList}
3943
*/
@@ -43,13 +47,17 @@ public CopyableFileSmbPropertiesList setFileAttributes(Boolean fileAttributes) {
4347
}
4448

4549
/**
46-
* @return a flag indicating whether created on timestamp should be copied from source file.
50+
* Specifies whether created on timestamp should be copied from source file.
51+
*
52+
* @return {@code true} if created on timestamp should be copied.
4753
*/
4854
public Boolean isCreatedOn() {
4955
return isSetCreatedOn;
5056
}
5157

5258
/**
59+
* Specify whether created on timestamp should be copied from source file.
60+
*
5361
* @param createdOn Flag indicating whether to copy created on timestamp from source file
5462
* @return the updated {@link CopyableFileSmbPropertiesList}
5563
*/
@@ -59,13 +67,17 @@ public CopyableFileSmbPropertiesList setCreatedOn(Boolean createdOn) {
5967
}
6068

6169
/**
62-
* @return a flag indicating whether last written on timestamp should be copied from source file.
70+
* Specifies whether last written on timestamp should be copied from source file.
71+
*
72+
* @return {@code true} if last written on timestamp should be copied.
6373
*/
6474
public Boolean isLastWrittenOn() {
6575
return isSetLastWrittenOn;
6676
}
6777

6878
/**
79+
* Specify whether last written on timestamp should be copied from source file.
80+
*
6981
* @param lastWrittenOn Flag indicating whether to copy last written on timestamp from source file
7082
* @return the updated {@link CopyableFileSmbPropertiesList}
7183
*/
@@ -75,13 +87,17 @@ public CopyableFileSmbPropertiesList setLastWrittenOn(Boolean lastWrittenOn) {
7587
}
7688

7789
/**
78-
* @return a flag indicating whether changed on timestamp should be copied from source file.
90+
* Specifies whether changed on timestamp should be copied from source file.
91+
*
92+
* @return {@code true} if changed on timestamp should be copied.
7993
*/
8094
public Boolean isChangedOn() {
8195
return isSetChangedOn;
8296
}
8397

8498
/**
99+
* Specify whether changed on timestamp should be copied from source file.
100+
*
85101
* @param changedOn Flag indicating whether to copy changed on timestamp from source file
86102
* @return the updated {@link CopyableFileSmbPropertiesList}
87103
*/
@@ -91,7 +107,33 @@ public CopyableFileSmbPropertiesList setChangedOn(Boolean changedOn) {
91107
}
92108

93109
/**
94-
* @return a list of the flag set to true
110+
* Specifies whether all properties should be copied from source file.
111+
*
112+
* @return whether all properties should be copied from the source file.
113+
*/
114+
public Boolean isAll() {
115+
return (isSetFileAttributes != null && isSetFileAttributes)
116+
&& (isSetCreatedOn != null && isSetCreatedOn)
117+
&& (isSetLastWrittenOn != null && isSetLastWrittenOn)
118+
&& (isSetChangedOn != null && isSetChangedOn);
119+
}
120+
121+
/**
122+
* Specifies whether no properties should be copied from source file.
123+
*
124+
* @return whether no properties should be copied from the source file.
125+
*/
126+
public Boolean isNone() {
127+
return (isSetFileAttributes == null || !isSetFileAttributes)
128+
&& (isSetCreatedOn == null || !isSetCreatedOn)
129+
&& (isSetLastWrittenOn == null || !isSetLastWrittenOn)
130+
&& (isSetChangedOn == null || !isSetChangedOn);
131+
}
132+
133+
/**
134+
* Gets list of properties that are set to true.
135+
*
136+
* @return a list of the flag set to true.
95137
*/
96138
public List<CopyableFileSmbProperties> toList() {
97139
List<CopyableFileSmbProperties> details = new ArrayList<>();

0 commit comments

Comments
 (0)