Package org.sosy_lab.common
Class MoreStrings
- java.lang.Object
-
- org.sosy_lab.common.MoreStrings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMoreStrings.WithLongStringInterface for classes that have a second, longer, string representation (with more information) in addition toObject.toString().
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectlazyString(Supplier<String> stringSupplier)Return anObjectinstance whoseObject.toString()method lazily delegates to the given supplier.static ObjectlongStringOf(MoreStrings.WithLongString obj)Return anObjectinstance whoseObject.toString()method delegates toMoreStrings.WithLongString.toLongString().static booleanstartsWithIgnoreCase(String s, String prefix)Check whether a string starts with a given prefix similar toString.startsWith(String), but ignoring the case likeString.equalsIgnoreCase(String).
-
-
-
Method Detail
-
startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String s, String prefix)
Check whether a string starts with a given prefix similar toString.startsWith(String), but ignoring the case likeString.equalsIgnoreCase(String).- Parameters:
s- The string to check whether it contains the prefix.prefix- The prefix.- Returns:
- Whether
sstarts withprefixin any case.
-
lazyString
@CheckReturnValue public static Object lazyString(Supplier<String> stringSupplier)
Return anObjectinstance whoseObject.toString()method lazily delegates to the given supplier. This can be used for logging to make a single logging argument lazy, e.g.logger.log(Level.FINE, "Some message with %s and %s args", lazyString(() -> "lazy"), "eager");- Parameters:
stringSupplier- A non-null supplier that returns a non-null string.- Returns:
- A object that should only be used for
Object.toString().
-
longStringOf
@CheckReturnValue public static Object longStringOf(MoreStrings.WithLongString obj)
Return anObjectinstance whoseObject.toString()method delegates toMoreStrings.WithLongString.toLongString(). This can be used for logging as a lazy alternative to callingMoreStrings.WithLongString.toLongString()directly, e.g.logger.log(Level.FINE, longStringOf(instance));- Parameters:
obj- A non-null instance ofMoreStrings.WithLongString- Returns:
- A object that should only be used for
Object.toString().
-
-