java.lang.Object
io.modelcontextprotocol.util.Utils
Miscellaneous utility methods.
- Author:
- Christian Tzolov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCheck whether the givenStringcontains actual text.static booleanisEmpty(Collection<?> collection) Returntrueif the supplied Collection isnullor empty.static booleanReturntrueif the supplied Map isnullor empty.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
hasText
Check whether the givenStringcontains actual text.More specifically, this method returns
trueif theStringis notnull, its length is greater than 0, and it contains at least one non-whitespace character.- Parameters:
str- theStringto check (may benull)- Returns:
trueif theStringis notnull, its length is greater than 0, and it does not contain whitespace only- See Also:
-
isEmpty
Returntrueif the supplied Collection isnullor empty. Otherwise, returnfalse.- Parameters:
collection- the Collection to check- Returns:
- whether the given Collection is empty
-
isEmpty
Returntrueif the supplied Map isnullor empty. Otherwise, returnfalse.- Parameters:
map- the Map to check- Returns:
- whether the given Map is empty
-