java.lang.Object
io.github.projectunified.craftcommand.processor.Naming

public final class Naming extends Object
Pure naming utilities for generated fields, methods, and identifiers.

Centralizes the naming conventions used across the code generator so that the same logical concept always maps to the same generated name. All methods are static and side-effect free.

  • Method Details

    • simpleName

      public static String simpleName(com.palantir.javapoet.TypeName typeName)
      Returns:
      the simple name of a TypeName (text after the last dot).
    • subcommandField

      public static String subcommandField(com.palantir.javapoet.ClassName nestedClass)
      Returns:
      the field name for a nested subcommand class instance, e.g. subInstance_outer_inner for class Outer.Inner.
    • resolverMethod

      public static String resolverMethod(com.palantir.javapoet.TypeName type)
      Returns:
      the helper method name for resolving a dynamic (global-resolver) parameter type, e.g. resolve_com_example_Foo.
    • suggestMethod

      public static String suggestMethod(String classModelPath, String methodOrDefault, int paramIndex)
      Parameters:
      classModelPath - the lowercased dot-joined class simple-names
      methodOrDefault - the subcommand name, or "default" for the default action
      paramIndex - the zero-based parameter index
      Returns:
      the helper method name for a parameter's suggestion provider.
    • classPath

      public static String classPath(com.palantir.javapoet.ClassName className)
      Returns:
      the lowercased dot-joined simple-names of a class, used as a disambiguating prefix for generated identifiers.
    • executeHelper

      public static String executeHelper(com.palantir.javapoet.ClassName nestedClass)
      Returns:
      "execute_" + lowercased class path — the routing helper for a nested subcommand class.
    • suggestHelper

      public static String suggestHelper(com.palantir.javapoet.ClassName nestedClass)
      Returns:
      "suggest_" + lowercased class path — the suggestion routing helper for a nested subcommand class.
    • sanitizeIdentifier

      public static String sanitizeIdentifier(String name)
      Returns:
      a valid Java identifier derived from an arbitrary command name (replaces - and spaces with _).