How to extend MobileElement class in while using page factory pattern

I have a cross platform app to test; hence I am relying on PageFactory pattern to reduce the overhead. I am trying to extend the MobileElement class so that I can have build methods like tap or setText in which I can write the logic to wait for the element to be visible before clicking or setting value. I don’t want to sacrifice the page object pattern - so I want to write something like this.

My driver is declared as -
private static AppiumDriver<? extends MobileElement> driver
and in the page I have initialised the constructor as

public PasscodePage(AppiumDriver<? extends MobileElement> driver) {
    pageElements = new PasscodePageElements(driver);

And my element is defined as

@FindBy(xpath = "//android.widget.TextView[@text='1']")
AppElement pin1;

where AppElement extends MobileElement. If I use MobileElement instead of AppElement everything works fine. However in former case, I am getting error as

Error Message: java.lang.IllegalArgumentException: Can not set field to$$EnhancerByCGLIB$$b598166c

Kindly let me know where I am going wrong.