Class PropertyTypeRef<T>

  • Type Parameters:
    T - the generic type of the property.

    public class PropertyTypeRef<T>
    extends java.lang.Object
    Understands the type of a property to access using Bean Instrospection. This implementation supports Java generics.

    The following is an example of proper usage of this class:

       // Retrieves the value of the property "powers"
       List<String> powers = property("powers").ofType(new TypeRef<List<String>>() {}).in(jedi).get();
    
       // Sets the value of the property "powers"
       List<String> powers = new ArrayList<String>();
       powers.add("heal");
       property("powers").ofType(new TypeRef<List<String>>() {}).in(jedi).set(powers);
     

    Since:
    1.2
    Author:
    Alex Ruiz
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Invoker<T> in​(java.lang.Object target)
      Returns a new property invoker.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • in

        public Invoker<T> in​(java.lang.Object target)
        Returns a new property invoker. A property invoker is capable of accessing (read/write) the underlying property.
        Parameters:
        target - the object containing the property of interest.
        Returns:
        the created property invoker.
        Throws:
        java.lang.NullPointerException - if the given target is null.
        ReflectionError - if a property with a matching name and type cannot be found.