Converts the human readable string to the proper enum @param type The string to parse @return The parsed enum @throws IllegalArgumentException if the type is missing or wsa not recognized
(final String type)
| 154 | * recognized |
| 155 | */ |
| 156 | public static SearchType parseSearchType(final String type) { |
| 157 | if (type == null || type.isEmpty()) { |
| 158 | throw new IllegalArgumentException("Type provided was null or empty"); |
| 159 | } |
| 160 | |
| 161 | if (type.toLowerCase().equals("tsmeta")) { |
| 162 | return SearchType.TSMETA; |
| 163 | } else if (type.toLowerCase().equals("tsmeta_summary")) { |
| 164 | return SearchType.TSMETA_SUMMARY; |
| 165 | } else if (type.toLowerCase().equals("tsuids")) { |
| 166 | return SearchType.TSUIDS; |
| 167 | } else if (type.toLowerCase().equals("uidmeta")) { |
| 168 | return SearchType.UIDMETA; |
| 169 | } else if (type.toLowerCase().equals("annotation")) { |
| 170 | return SearchType.ANNOTATION; |
| 171 | } else if (type.toLowerCase().equals("lookup")) { |
| 172 | return SearchType.LOOKUP; |
| 173 | } else { |
| 174 | throw new IllegalArgumentException("Unknown type: " + type); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | // GETTERS AND SETTERS -------------------------- |
| 179 |