4

When developing in APEX I'm frequently creating utility class where I put my static final strings (like picklist values etc.)

public static final String ATR_TYPE_PICKLIST = 'Picklist';

And then use them in the code like below:

if (type == ATR_TYPE_PICKLIST) {
   ... 
}

What would be the best approach to use corresponding pattern in Lightning Components? I would want to avoid using hardcoded values in the code like below:

if (attributeParam.name == 'ATR_BLOCATIONDETAILS_') { 
   ...
} 
3
  • Your post is tagged with Apex. Are you using a server-side apex controller? If not, you'd be asking about javascript methods. Please clarify your question.
    – crmprogdev
    May 18 '16 at 14:19
  • Yes, I'm using server side APEX controller in many places, but there is no way to access static variables without defining getters and remote actions. My question is rather what would be the best approach in terms of architecture (or what would be recommended pattern) May 18 '16 at 16:46
  • Architecture or patterns for accessing APEX controller static variables from lightning components? Just want to be clear whether or not APEX has anything to do with your question.
    – crmprogdev
    May 18 '16 at 17:02