Interface StringSelector


public interface StringSelector
Fluent api for checking one or more strings and selecting the first non-empty one.

invalid reference
#toString()
returns the first encountered non-empty string or "".

Optimized so that no intermediary objects are created, only one, once the first non-empty string is found.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final StringSelector
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    May be used to stop processing subsequent inputs when a result is already available.
    of(String... strings)
    Starts the fluent expression by checking the first string(s).
    or(String... strings)
    Check the next string(s).
  • Field Details

    • EMPTY_STRING_SELECTOR

      static final StringSelector EMPTY_STRING_SELECTOR
  • Method Details

    • of

      static StringSelector of(String... strings)
      Starts the fluent expression by checking the first string(s).
      Parameters:
      strings - The first string(s) to check if empty.
      Returns:
      a StringSelector that checked the first string.
    • or

      StringSelector or(String... strings)
      Check the next string(s).
      Parameters:
      strings - The next string(s) to check if empty.
      Returns:
      a StringSelector that checked all strings so far.
    • found

      boolean found()
      May be used to stop processing subsequent inputs when a result is already available.
      Returns:
      true if a non-empty string has been found, false otherwise.