I'm trying to build a VF component that references an attribute that is an instance of an inner class. I followed the suggestion here on the Apex boards but it does not compile for me using V28.0. (Note the boards post was about lists of inner class objects - I only need a single instance)
Interface, Apex class, VF component follow:
public interface VFComponentAttributable {
// To make inner classes available as VF component attributes
// http://boards.developerforce.com/t5/Visualforce-Development/Error-using-inner-class-in-component-attribute/td-p/147856
}
public with sharing class Foo {
public class InnerBar implements VFComponentAttributable{
public String myVbl {get; set;}
}
}
<apex:component >
<!-- Generates compiler error 'Unknown property VFComponentAttributable.myVbl' -->
<apex:attribute name="bar" description="instance of inner class"
type="VFComponentAttributable" required="true"/>
<apex:outputText value="{!bar.myVbl}"/>
<!-- This doesnt work either, generates compiler error 'Apex class InnerBar does not exist
<apex:attribute name="bar" description="instance of inner class"
type="Foo.InnerBar" required="true"/>
<apex:outputText value="{!bar.myVbl}"/> -->
I know I can refactor and make the inner class an outer class and it will work but I'd rather not if I can avoid it.