Class Resolvers


  • public final class Resolvers
    extends Object
    Performs object resolution by object type. A given object may have more than one resolver, depending on what class it extends and/or interfaces it implements, or what its superclasses and interfaces are.
    • Field Detail

      • SERVICES

        public static final Map<Class,​Resolver> SERVICES
        Mapping of supported classes to associated resolvers.
    • Method Detail

      • resolvers

        public static Iterable<Resolver> resolvers​(Object object)
        Provides an iterable object over the resolvers that are appropriate for a particular object. Resolvers are provided ordered from most specific to class/interface to least. Resolvers are provided through an iterator interface to avoid the overhead of determining all resolvers in advance.
        Parameters:
        object - the object for which a set of resolvers is being sought.
        Returns:
        an object that returns an iterator over the set of resolvers for the object.
      • get

        public static Object get​(Object object,
                                 Object element)
        Attempts to resolve an element of an object.
        Parameters:
        object - the object in which to resolve the specified element.
        element - the element to resolve within the specified object.
        Returns:
        the value of the resolved element, or UNRESOLVED if it cannot be resolved.
        See Also:
        Resolver.get(Object, Object)
      • put

        public static Object put​(Object object,
                                 Object element,
                                 Object value)
        Attempts to set the value of an element of an object.
        Parameters:
        object - the object in which to resolve the specified element.
        element - the element within the specified object whose value is to be set.
        value - the value to set the element to.
        Returns:
        the previous value of the element, null if no previous value, or UNRESOLVED if it cannot be resolved.
        See Also:
        Resolver.put(Object, Object, Object)