Package com.google.cloud
Class StringEnumType<EnumT>
- java.lang.Object
-
- com.google.cloud.StringEnumType<EnumT>
-
@InternalApi public class StringEnumType<EnumT> extends Object
This represents a concept having a known set of acceptable String values, which can expand later due to new API features.
-
-
Constructor Summary
Constructors Constructor Description StringEnumType(Class<EnumT> clazz, ApiFunction<String,EnumT> constructor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EnumTcreateAndRegister(String constant)Create a new constant and register it in the known values.EnumTvalueOf(String constant)Get the enum object for the given String constant, and allow unrecognized values.EnumTvalueOfStrict(String constant)Get the enum object for the given String constant, and throw an exception if the constant is not recognized.EnumT[]values()Return the known values of this enum type.
-
-
-
Constructor Detail
-
StringEnumType
public StringEnumType(Class<EnumT> clazz, ApiFunction<String,EnumT> constructor)
-
-
Method Detail
-
createAndRegister
public EnumT createAndRegister(String constant)
Create a new constant and register it in the known values.
-
valueOfStrict
public EnumT valueOfStrict(String constant)
Get the enum object for the given String constant, and throw an exception if the constant is not recognized.
-
valueOf
public EnumT valueOf(String constant)
Get the enum object for the given String constant, and allow unrecognized values.
-
values
public EnumT[] values()
Return the known values of this enum type.
-
-