Class StringDecorator<T>

java.lang.Object
com.csse3200.game.utils.StringDecorator<T>
Type Parameters:
T - Class to decorate

public class StringDecorator<T> extends Object
Apply a custom toString() for a class without overriding the class, using a decorator.
  • Field Details

  • Constructor Details

    • StringDecorator

      public StringDecorator(T object, Function<T,String> printFn)
      Create a string-decorated object.
      Parameters:
      object - Object to decorate.
      printFn - Function which takes the object and returns the desired string representation.
  • Method Details