Interface Wrapper<W>

All Superinterfaces:
Named

public interface Wrapper<W> extends Named
Abstraction for an object which is a wrapper for another object, which may be of the same or a different type, and may exist in a hierarchy of such objects, with methods for resolving such wrapped objects in a type-safe way.
Author:
Tim Boudreau
  • Method Summary

    Modifier and Type
    Method
    Description
    default <F> F
    find(Class<? super F> what)
     
    static <F> F
    find(Object o, Class<? super F> what)
     
    default <F> boolean
    has(Class<? super F> what)
     
    default String
    Finds any instance of the Named interface, and returns the result if its name() method if present, and if not, returns toString() on the wrapped object.
    default W
     
    static <P1> P1
    root(P1 o)
     
    Get the object wrapped by this one.

    Methods inherited from interface com.mastfrog.abstractions.Named

    appendTo
  • Method Details

    • wrapped

      W wrapped()
      Get the object wrapped by this one.
      Returns:
      The wrapped object or null
    • root

      default W root()
    • name

      default String name()
      Finds any instance of the Named interface, and returns the result if its name() method if present, and if not, returns toString() on the wrapped object.
      Specified by:
      name in interface Named
      Returns:
      A name or toString() value, or "null" if the wrapped object is null
    • root

      static <P1> P1 root(P1 o)
    • find

      static <F> F find(Object o, Class<? super F> what)
    • has

      default <F> boolean has(Class<? super F> what)
    • find

      default <F> F find(Class<? super F> what)