Class ValueHandlerUtil


  • public class ValueHandlerUtil
    extends Object
    • Field Detail

      • ARGUMENT_KEY

        public static String ARGUMENT_KEY
    • Constructor Detail

      • ValueHandlerUtil

        public ValueHandlerUtil()
    • Method Detail

      • getEnum

        public static <T extends Enum<T>> T getEnum​(Class<T> enumClass,
                                                    Object input,
                                                    String parameterName)
        Get the valid enum value from a configuration parameter if possible.
        Parameters:
        enumClass - the enum to use
        input - the configuration input to search the enumClass
        parameterName - the name to report to the user if no valid enum values are found
        Returns:
        the enum value or null
      • booleanValueHandler

        public static Boolean booleanValueHandler​(Object input)
      • getIntegerWithConstraints

        public static Integer getIntegerWithConstraints​(Object input,
                                                        String errorMessage,
                                                        List<Integer> validValues)
        Get an integer entry, with constraints.
        Parameters:
        input - the user supplied input
        errorMessage - the error message that should be returned if none of the valid values match. This message should end with the string "one of the allowed values: ", because the allowed values will be appended to this error message before it is used.
        validValues - the permissible values for the input