Highlighted

How to reinheritance a Component Java class that inherits WCMUsePojo

pdg2491

30-09-2019

Hello,

I am currently configuring a component using the Java Use-API. (under the apps folder)

In a situation where i need to create another Component that inherits Container Component,
i want to use a Java class by inheriting a Java class that inherits Container Component's WCMUsePojo.

[Test Code]

1. Conatiner java

public class Container extends WCMUsePojo {

     @Override

     public void activate() throws Exception {}

     public String getText(String text) {

          ...

          return String

}

2. Controller java

public class Controller extends Container {

  private  String resourceData;

   @Override
   public void activate() throws Exception {

        String testText = "This is Test Text"

        resourceData = getText(testText);
        ...

   }

}

I ran the test with the code above, I could see one thing.

When Authoring Controller Component, Error message occurs until Authoring Container Component and executing getText method.

[error message]

Identifier Controller cannot be correctly instantiated by the Use API

I guess to the issue, Java class configured in Component is not used in AEM Memory before Page Authoring

Can't i use this method?