Package io.temporal.internal.common
Class ProtoEnumNameUtils
- java.lang.Object
-
- io.temporal.internal.common.ProtoEnumNameUtils
-
public class ProtoEnumNameUtils extends java.lang.Object
Because in Go enums are in a shared namespace, one of protobuf common practices is to prefix the enums with enum name prefix to create unique names. The final result is verbose and when we use a string representation of some enum in different parts of the system (history json or search attribute types), we use a short version without prefix in camel case. So, protobuf enumEventType.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED
gets converted to "WorkflowExecutionStarted"AIP 126
- The other values should not be prefixed by the name of the enum itself. This generally requires users to write MyState.MYSTATE_ACTIVE in their code, which is unnecessarily verbose. - To avoid sharing values, APIs may prefix enum values with the name of the enum. In this case, they must do so consistently within the enum.- See Also:
- AIP 126, Related commit to Go Proto module
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMMAND_TYPE_PREFIX
static java.util.Map<java.lang.Class<?>,java.lang.String>
ENUM_CLASS_TO_PREFIX
static java.lang.String
INDEXED_VALUE_TYPE_PREFIX
static java.lang.String
WORKFLOW_TASK_FAILED_CAUSE_PREFIX
-
Constructor Summary
Constructors Constructor Description ProtoEnumNameUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
simplifiedToUniqueName(java.lang.String enumName, java.lang.String prefix)
static java.lang.String
uniqueToSimplifiedName(java.lang.Enum<?> enumm)
static java.lang.String
uniqueToSimplifiedName(java.lang.String protoEnumName, java.lang.String prefix)
-
-
-
Field Detail
-
WORKFLOW_TASK_FAILED_CAUSE_PREFIX
public static final java.lang.String WORKFLOW_TASK_FAILED_CAUSE_PREFIX
- See Also:
- Constant Field Values
-
INDEXED_VALUE_TYPE_PREFIX
public static final java.lang.String INDEXED_VALUE_TYPE_PREFIX
- See Also:
- Constant Field Values
-
COMMAND_TYPE_PREFIX
public static final java.lang.String COMMAND_TYPE_PREFIX
- See Also:
- Constant Field Values
-
ENUM_CLASS_TO_PREFIX
public static final java.util.Map<java.lang.Class<?>,java.lang.String> ENUM_CLASS_TO_PREFIX
-
-
Method Detail
-
uniqueToSimplifiedName
@Nonnull public static java.lang.String uniqueToSimplifiedName(@Nonnull java.lang.Enum<?> enumm)
-
uniqueToSimplifiedName
public static java.lang.String uniqueToSimplifiedName(java.lang.String protoEnumName, java.lang.String prefix)
-
simplifiedToUniqueName
public static java.lang.String simplifiedToUniqueName(java.lang.String enumName, java.lang.String prefix)
-
-