Skip navigation links
com.auxiliary.http

Enum SearchType

    • Enum Constant Detail

      • HEADER

        public static final SearchType HEADER
        搜索响应头信息
      • BODY

        public static final SearchType BODY
        搜索响应体信息
      • STATUS

        public static final SearchType STATUS
        搜索响应状态码
      • MESSAGE

        public static final SearchType MESSAGE
        搜索响应消息
    • Method Detail

      • values

        public static SearchType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SearchType c : SearchType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SearchType valueOf(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • typeText2Type

        public static SearchType typeText2Type(String type)
        该方法用于将枚举文本转换为消息枚举

        该方法本质上与valueOf(String)方法的作用一致,但其中加上了对文本的内容的判空、对文本内容大写转换、 对特殊文本进行处理以及对异常文本进行汉化的操作。

        Parameters:
        type - 枚举文本内容
        Returns:
        转换后的枚举
        Throws:
        IllegalArgumentException - 当枚举文本为空或不能转换成枚举时抛出的异常
        Since:
        autest 3.7.0
      • typeText2Type

        public static SearchType typeText2Type(String type,
                                               Function<String,String> mapper)
        该方法用于将枚举文本转换为消息枚举

        该方法与typeText2Type(String)方法类似,其可对传入的文本进行自定义的转换,例如欲将传入的"bo"转换为"body",则可写为

         SearchType.typeText2MessageType("bo", type -> {
              if ("bo".equals(text)) {
                  text = "body";
              }
        
              return text;
         });
         

        Parameters:
        type - 枚举文本内容
        mapper - 枚举文本的处理方法
        Returns:
        转换后的枚举
        Throws:
        IllegalArgumentException - 当枚举文本为空或不能转换成枚举时抛出的异常
        Since:
        autest 3.7.0

Copyright © 2024. All rights reserved.