Package com.csse3200.game.utils
Class StringDecorator<T>
java.lang.Object
com.csse3200.game.utils.StringDecorator<T>
- Type Parameters:
T
- Class to decorate
Apply a custom toString() for a class without overriding the class, using a decorator.
-
Constructor Summary
ConstructorsConstructorDescriptionStringDecorator
(T object, Function<T, String> printFn) Create a string-decorated object. -
Method Summary
-
Constructor Details
-
StringDecorator
Create a string-decorated object.- Parameters:
object
- Object to decorate.printFn
- Function which takes the object and returns the desired string representation.
-
-
Method Details