Interface Stringifier
- All Known Implementing Classes:
ReflectionStringifier
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A stringifier is a function for transforming objects to a string representations.
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringifierorElse(Stringifier stringifier) Returns a new stringifier using the given stringifier as an alternative to the current stringifier if the current stringifier cannot create a string representation.default StringCreates a string representation of the given object ornull, if no string representation can be created.default StringstringifyOrElseDefault(Object object, String defaultString) Creates a string representation of the given object or use the given default string, if no string representation can be created.default StringstringifyOrElseDefault(Object object, Supplier<String> defaultStringSupplier) Creates a string representation of the given object or the default string supplied by the given suuplier, if no string representation can be created.stringifyOrElseNull(Object object) Creates a string representation of the given object ornull, if no string representation can be created.default StringstringifyOrElseToString(Object object) Creates a string representation of the given object or useString.toString(), if no string representation can be created.
-
Method Details
-
orElse
Returns a new stringifier using the given stringifier as an alternative to the current stringifier if the current stringifier cannot create a string representation.- Parameters:
stringifier- the stringifier to use as an alternative to the current stringifier- Returns:
- the new stringifier using the given stringifier as an alternative to the current stringifier
-
stringify
Creates a string representation of the given object or
null, if no string representation can be created.This method is a shortcut for
stringifyOrElseNull(Object)- Parameters:
object- the object to create a string representation for- Returns:
- the string representation of the given object or
null
-
stringifyOrElseDefault
Creates a string representation of the given object or the default string supplied by the given suuplier, if no string representation can be created.- Parameters:
object- the object to create a string representation fordefaultStringSupplier- the supplier to use if no string representation can be created- Returns:
- the string representation of the given object
-
stringifyOrElseDefault
Creates a string representation of the given object or use the given default string, if no string representation can be created.- Parameters:
object- the object to create a string representation fordefaultString- the default string to use if no string representation can be created- Returns:
- the string representation of the given object
-
stringifyOrElseNull
Creates a string representation of the given object ornull, if no string representation can be created.- Parameters:
object- the object to create a string representation for- Returns:
- the string representation of the given object or
null
-
stringifyOrElseToString
Creates a string representation of the given object or useString.toString(), if no string representation can be created.- Parameters:
object- the object to create a string representation for- Returns:
- the string representation of the given object
-