Class DefaultFieldDecorator

  • All Implemented Interfaces:
    FieldDecorator

    public class DefaultFieldDecorator
    extends java.lang.Object
    implements FieldDecorator
    Default decorator for use with PageFactory. Will decorate 1) all of the WebElement fields and 2) List<WebElement> fields that have @FindBy, @FindBys, or @FindAll annotation with a proxy that locates the elements using the passed in ElementLocatorFactory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object decorate​(java.lang.ClassLoader loader, java.lang.reflect.Field field)
      This method is called by PageFactory on all fields to decide how to decorate the field.
      protected boolean isDecoratableList​(java.lang.reflect.Field field)  
      protected java.util.List<org.openqa.selenium.WebElement> proxyForListLocator​(java.lang.ClassLoader loader, ElementLocator locator)  
      protected org.openqa.selenium.WebElement proxyForLocator​(java.lang.ClassLoader loader, ElementLocator locator)  
      • Methods inherited from class java.lang.Object

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

      • decorate

        public java.lang.Object decorate​(java.lang.ClassLoader loader,
                                         java.lang.reflect.Field field)
        Description copied from interface: FieldDecorator
        This method is called by PageFactory on all fields to decide how to decorate the field.
        Specified by:
        decorate in interface FieldDecorator
        Parameters:
        loader - The class loader that was used for the page object
        field - The field that may be decorated.
        Returns:
        Value to decorate the field with or null if it shouldn't be decorated. If non-null, must be assignable to the field.
      • isDecoratableList

        protected boolean isDecoratableList​(java.lang.reflect.Field field)
      • proxyForLocator

        protected org.openqa.selenium.WebElement proxyForLocator​(java.lang.ClassLoader loader,
                                                                 ElementLocator locator)
      • proxyForListLocator

        protected java.util.List<org.openqa.selenium.WebElement> proxyForListLocator​(java.lang.ClassLoader loader,
                                                                                     ElementLocator locator)