Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reproduction components for a Spring '18 issue with virtual classes and lightning
public class MyOverrideClass extends MyVirtualClass {
@auraEnabled
public override String getName() {
return 'MyOverrideClass';
}
@auraEnabled
public override Object getObj() {
return 'Hello World';
}
}
public virtual class MyVirtualClass {
@auraEnabled
public virtual String getName() {
return 'MyVirtualClass';
}
@auraEnabled
public virtual Object getObj() {
return 99;
}
@auraEnabled
public Integer getVirtualOnlyValue() {
return 1;
}
}
<aura:component controller="VirtualClassTestController" implements="forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="dataString" type="String" access="PRIVATE" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<lightning:card title="Spring '18 Issue Reproduction">
<p class="slds-m-vertical_small">We should be seeing a <code>name</code> value of "MyOverrideClass" and an obj of type String with a value of '11'</p>
<h2 class="slds-text-heading_small">Data</h2>
<pre>{!v.dataString}</pre>
</lightning:card>
</aura:component>
public class VirtualClassTestController {
@auraEnabled
public static MyOverrideClass getClass() {
return new MyOverrideClass();
}
}
({
doInit : function(component, event, helper) {
var action = component.get('c.getClass');
action.setCallback(this, function(response){
var data = response.getReturnValue();
component.set('v.dataString', JSON.stringify(data));
});
$A.enqueueAction(action);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment