Skip to content

Commit ded5357

Browse files
Addressing some Codacy comments
1 parent d6f19ab commit ded5357

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

google-cloud-core/src/main/java/com/google/cloud/StringEnumValue.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
* a context.
2525
*/
2626
public abstract class StringEnumValue {
27-
private String constant;
27+
private final String constant;
2828

29+
/**
30+
* Don't create subclasses outside of google-cloud-java.
31+
*/
2932
@InternalApi
3033
protected StringEnumValue(String constant) {
3134
this.constant = Preconditions.checkNotNull(constant);

google-cloud-core/src/test/java/com/google/cloud/StringEnumTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ private Letter(String constant) {
3434
super(constant);
3535
}
3636

37-
private static ApiFunction<String, Letter> CONSTRUCTOR =
37+
private static final ApiFunction<String, Letter> CONSTRUCTOR =
3838
new ApiFunction<String, Letter>() {
3939
@Override
4040
public Letter apply(String constant) {
4141
return new Letter(constant);
4242
}
4343
};
4444

45-
private static StringEnumType<Letter> type = new StringEnumType(
45+
private static final StringEnumType<Letter> type = new StringEnumType(
4646
Letter.class,
4747
CONSTRUCTOR);
4848

49-
public static Letter A = type.createAndRegister("A");
50-
public static Letter B = type.createAndRegister("B");
51-
public static Letter C = type.createAndRegister("C");
49+
public static final Letter A = type.createAndRegister("A");
50+
public static final Letter B = type.createAndRegister("B");
51+
public static final Letter C = type.createAndRegister("C");
5252

5353
public static Letter valueOfStrict(String constant) {
5454
return type.valueOfStrict(constant);

google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClass.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,47 @@ private StorageClass(String constant) {
2929
super(constant);
3030
}
3131

32-
private static ApiFunction<String, StorageClass> CONSTRUCTOR =
32+
private static final ApiFunction<String, StorageClass> CONSTRUCTOR =
3333
new ApiFunction<String, StorageClass>() {
3434
@Override
3535
public StorageClass apply(String constant) {
3636
return new StorageClass(constant);
3737
}
3838
};
3939

40-
private static StringEnumType<StorageClass> type = new StringEnumType(
40+
private static final StringEnumType<StorageClass> type = new StringEnumType(
4141
StorageClass.class,
4242
CONSTRUCTOR);
4343

4444
/**
4545
* Regional storage class.
4646
*/
47-
public static StorageClass REGIONAL = type.createAndRegister("REGIONAL");
47+
public static final StorageClass REGIONAL = type.createAndRegister("REGIONAL");
4848

4949
/**
5050
* Multi-regional storage class.
5151
*/
52-
public static StorageClass MULTI_REGIONAL = type.createAndRegister("MULTI_REGIONAL");
52+
public static final StorageClass MULTI_REGIONAL = type.createAndRegister("MULTI_REGIONAL");
5353

5454
/**
5555
* Nearline storage class.
5656
*/
57-
public static StorageClass NEARLINE = type.createAndRegister("NEARLINE");
57+
public static final StorageClass NEARLINE = type.createAndRegister("NEARLINE");
5858

5959
/**
6060
* Coldline storage class.
6161
*/
62-
public static StorageClass COLDLINE = type.createAndRegister("COLDLINE");
62+
public static final StorageClass COLDLINE = type.createAndRegister("COLDLINE");
6363

6464
/**
6565
* Standard storage class.
6666
*/
67-
public static StorageClass STANDARD = type.createAndRegister("STANDARD");
67+
public static final StorageClass STANDARD = type.createAndRegister("STANDARD");
6868

6969
/**
7070
* Durable Reduced Availability (deprecated)
7171
*/
72-
public static StorageClass DURABLE_REDUCED_AVAILABILITY = type.createAndRegister(
72+
public static final StorageClass DURABLE_REDUCED_AVAILABILITY = type.createAndRegister(
7373
"DURABLE_REDUCED_AVAILABILITY");
7474

7575
/**

0 commit comments

Comments
 (0)