Class Wrapper<T>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Wrapper​(T delegate)
      Constructor providing a delegate wrapped object.
    • Constructor Detail

      • Wrapper

        protected Wrapper​(T delegate)
        Constructor providing a delegate wrapped object.
        Parameters:
        delegate - The delegate object being wrapped. This may only be null if the delegate() method is overridden to provide an alternative non-null result.
    • Method Detail

      • delegate

        protected T delegate()
        Delegate method that can be overridden in case the delegate is not yet available at construction time or when there some strategy applicable that determines the delegate at runtime.

        By default, the specified delegate value from the constructor is returned.

        Returns:
        The delegate for this wrapper.
      • nonNullDelegate

        protected final T nonNullDelegate()
        Acessor to provide a guaranteed non-null delegate instance for use within delegation method implementations.
        Returns:
        The delegate for this wrapper (guaranteed to be non-null).
        Throws:
        NullPointerException - with a specific message in case the delegate was null.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        The class name and the delegate string representation.