java.lang.Object
org.springframework.shell.core.utils.Utils

public class Utils extends Object
Some text utilities.
Author:
Eric Bottard, Mahmoud Ben Hassine
  • Field Details

    • QUIT_COMMAND

      public static final Command QUIT_COMMAND
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • isProfileActive

      public static boolean isProfileActive(Method method, org.springframework.core.env.Environment environment)
      Check if a method is annotated with an active Profile in the given environment.
      Parameters:
      method - the method to check
      environment - the environment
      Returns:
      true if the method has an active profile, false otherwise
      Since:
      4.0.2
    • splitCamelCase

      public static String splitCamelCase(String className)
      Split a CamelCase class name into separate words. Used to derive command group names. For example, "MyCommands" becomes "My Commands".
      Parameters:
      className - the simple class name
      Returns:
      the split string
    • unCamelify

      public static String unCamelify(CharSequence original)
      Turn CamelCaseText into gnu-style-lowercase.
    • formatAvailableCommands

      public static String formatAvailableCommands(CommandRegistry commandRegistry)
      Get a formatted string of available non-hidden commands from the command registry.
      Parameters:
      commandRegistry - the command registry
      Returns:
      a string of available commands with their descriptions
      Since:
      4.0.0
    • getDefaultValueForPrimitiveType

      public static Object getDefaultValueForPrimitiveType(Class<?> type)
    • defaultValidatorFactory

      public static jakarta.validation.ValidatorFactory defaultValidatorFactory()
      Gets a default shared validation factory.
      Returns:
      default validation factory
    • defaultValidator

      public static jakarta.validation.Validator defaultValidator()
      Gets a default shared validator.
      Returns:
      default validator