I am trying to access this protected class: protected boolean canDraw()
, and get its value placed into a variable. Two ways I'm trying to access it are not working:
<%@ page import="com.day.cq.wcm.foundation.Image" %>
<%@include file="/apps/tju/global.jsp"%>
<% //.....
Image thisImage = new Image(resource); %>
boolean foo = thisImage.canDraw();
throws The method canDraw() from the type Image is not visible
and
boolean foo = super.canDraw();
throws The method canDraw() is undefined for the type HttpJspBase
Full javadoc of the class being used can be found here: http://dev.day.com/docs/en/cq/5-3/javadoc/com/day/cq/wcm/foundation/Image.html
The method is protected. Therefore, you cannot access it from outside of the package and the classes which inherit from the class.
You are trying to access a protected method from a JSP page. The JSP page is not a sub-class of Image and therefore cannot access the method.
If there is not a better way to do what you're trying to do, subclass Image and make a public accessor for the attribute you're trying to access.