Class MemberValueResolver<M extends java.lang.reflect.Member>

  • Type Parameters:
    M - The member type.
    All Implemented Interfaces:
    ValueResolver
    Direct Known Subclasses:
    FieldValueResolver, MethodValueResolver

    public abstract class MemberValueResolver<M extends java.lang.reflect.Member>
    extends java.lang.Object
    implements ValueResolver
    A specialization of ValueResolver that is built on top of reflections API. It use an internal cache for saving members.
    Since:
    0.1.1
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean matches​(M member, java.lang.String name)
      True, if the member matches the one we look for.
      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> propertySet​(java.lang.Object context)
      List all the properties and their values for the given object.
      java.lang.Object resolve​(java.lang.Object context)
      Resolve the the context object by optionally converting the value if necessary.
      java.lang.Object resolve​(java.lang.Object context, java.lang.String name)
      Resolve the attribute's name in the context object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MemberValueResolver

        public MemberValueResolver()
    • Method Detail

      • resolve

        public final java.lang.Object resolve​(java.lang.Object context,
                                              java.lang.String name)
        Description copied from interface: ValueResolver
        Resolve the attribute's name in the context object. If a ValueResolver.UNRESOLVED is returned, the context stack will continue with the next value resolver in the chain.
        Specified by:
        resolve in interface ValueResolver
        Parameters:
        context - The context object. Not null.
        name - The attribute's name. Not null.
        Returns:
        A ValueResolver.UNRESOLVED is returned, the context stack will continue with the next value resolver in the chain. Otherwise, it returns the associated value.
      • resolve

        public java.lang.Object resolve​(java.lang.Object context)
        Description copied from interface: ValueResolver
        Resolve the the context object by optionally converting the value if necessary. If a ValueResolver.UNRESOLVED is returned, the context stack will continue with the next value resolver in the chain.
        Specified by:
        resolve in interface ValueResolver
        Parameters:
        context - The context object. Not null.
        Returns:
        A ValueResolver.UNRESOLVED is returned, the context stack will continue with the next value resolver in the chain. Otherwise, it returns the associated value.
      • matches

        public abstract boolean matches​(M member,
                                        java.lang.String name)
        True, if the member matches the one we look for.
        Parameters:
        member - The class Member.
        name - The attribute's name.
        Returns:
        True, if the member matches the one we look for.
      • propertySet

        public java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> propertySet​(java.lang.Object context)
        Description copied from interface: ValueResolver
        List all the properties and their values for the given object.
        Specified by:
        propertySet in interface ValueResolver
        Parameters:
        context - The context object. Not null.
        Returns:
        All the properties and their values for the given object.