Class ProtoEnumNameUtils

java.lang.Object
io.temporal.internal.common.ProtoEnumNameUtils

public class ProtoEnumNameUtils extends 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 enum EventType.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:
  • Field Details

  • Constructor Details

    • ProtoEnumNameUtils

      public ProtoEnumNameUtils()
  • Method Details

    • uniqueToSimplifiedName

      @Nonnull public static String uniqueToSimplifiedName(@Nonnull Enum<?> enumm)
    • uniqueToSimplifiedName

      public static String uniqueToSimplifiedName(String protoEnumName, String prefix)
    • simplifiedToUniqueName

      public static String simplifiedToUniqueName(String enumName, String prefix)