I need use structure (or wrapper class) in Apex Enterprise Pattern.
public with sharing class Structure {
public String name { get; set;}
public Integer limit {get; set;}
private void methodName(){
this.name = SelectorLayerName.selectByLimit(this.limit);
}
When I use method from this class
private void methodName(){
this.name = SelectorLayerName.selectByLimit(this.limit);
}
I have an error
Non static method cannot be referenced from a static context: List<sObjectName> SObjectNameSelector.selectByLimit(Integer)
Selector layer method is down.
query from SObjectNameSelector
public List<sObjectName> selectByLimit (Integer limit){
fflib_QueryFactory sObjectNamesQueryFactory = newQueryFactory();
return (List<sObjectName>) Database.query(
sObjectNamesQueryFactory
.selectFields(new List<String>{'Id'})
.setLimit(limit)
.toSOQL()
);
//must return
//List<sObjectName> listSON = [SELECT Id FROM sObjectName LIMIT :limit]
}
How can I use this helper class in my layers or do I need create it as Apex Class and that's it? How can I resolve this problem?