We have an annotation that you can use to specify a Java enum to restrict the constant value to one of the values. You can declare it like this instead:

     @FunctionParseNode.Argument(enumeration = EncodeFormat)

Then create a Java enum in org.apache.phoenix.expression.function.EncodeFormat:

    public enum EncodeFormat { HEX };

Then you can get rid of the validation you do, as the built-in function class will do that for you.