Skip to content

Commit b9790c6

Browse files
Deprecating *Type and getType() for resource names (#40)
1 parent c2485ba commit b9790c6

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

sdk-platform-java/api-common-java/src/main/java/com/google/api/resourcenames/ResourceName.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
@BetaApi
3838
public interface ResourceName {
3939

40-
/** The ResourceNameType of the resource name object. */
40+
/**
41+
* The ResourceNameType of the resource name object.
42+
*
43+
* @deprecated With Oneof types being converted to use inheritance, this is no longer necessary.
44+
*/
45+
@Deprecated
4146
public ResourceNameType getType();
4247
}

sdk-platform-java/api-common-java/src/main/java/com/google/api/resourcenames/ResourceNameType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
/**
3737
* An interface that resource name types must implement. A ResourceNameType class is required for
3838
* any class that implements {@link ResourceName}.
39+
*
40+
* @deprecated With Oneof types being converted to use inheritance, this is no longer necessary.
3941
*/
4042
@BetaApi
43+
@Deprecated
4144
public interface ResourceNameType {}

sdk-platform-java/api-common-java/src/main/java/com/google/api/resourcenames/UntypedResourceName.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ private UntypedResourceName(String rawValue) {
4848
this.rawValue = Preconditions.checkNotNull(rawValue);
4949
}
5050

51+
/**
52+
* @deprecated use {@link #of(ResourceName)} instead.
53+
*/
54+
@Deprecated
5155
public static UntypedResourceName from(ResourceName resourceName) {
5256
return new UntypedResourceName(resourceName.toString());
5357
}
5458

59+
public static UntypedResourceName of(ResourceName resourceName) {
60+
return new UntypedResourceName(resourceName.toString());
61+
}
62+
5563
public static UntypedResourceName parse(String formattedString) {
5664
return new UntypedResourceName(formattedString);
5765
}
@@ -60,7 +68,12 @@ public static boolean isParsableFrom(String formattedString) {
6068
return true;
6169
}
6270

71+
/*
72+
* @deprecated With Oneof types being converted to use inheritance, this is
73+
* no longer necessary.
74+
*/
6375
@Override
76+
@Deprecated
6477
public ResourceNameType getType() {
6578
return UntypedResourceNameType.instance();
6679
}

sdk-platform-java/api-common-java/src/main/java/com/google/api/resourcenames/UntypedResourceNameType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@
3333

3434
import com.google.api.core.BetaApi;
3535

36-
/** The ResourceNameType for {@link UntypedResourceName}. */
36+
/**
37+
* The ResourceNameType for {@link UntypedResourceName}.
38+
*
39+
* @deprecated With Oneof types being converted to use inheritance, this is no longer necessary.
40+
*/
3741
@BetaApi
42+
@Deprecated
3843
public class UntypedResourceNameType implements ResourceNameType {
3944

4045
private static UntypedResourceNameType instance = new UntypedResourceNameType();

0 commit comments

Comments
 (0)