Returns the version given its string representation, current version if the argument is null or empty
(String version)
| 382 | * Returns the version given its string representation, current version if the argument is null or empty |
| 383 | */ |
| 384 | public static Version fromString(String version) { |
| 385 | if (!Strings.hasLength(version)) { |
| 386 | return Version.CURRENT; |
| 387 | } |
| 388 | final Version cached = STRING_TO_VERSION.get(version); |
| 389 | if (cached != null) { |
| 390 | return cached; |
| 391 | } |
| 392 | return fromStringSlow(version); |
| 393 | } |
| 394 | |
| 395 | private static Version fromStringSlow(String version) { |
| 396 | final boolean snapshot; // this is some BWC for 2.x and before indices |